Compare commits

..

19 Commits

Author SHA1 Message Date
Shaun Ruffell
48032024a3 wctc4xxp: Clear packet error count when reloading firmware.
When the firmware is reloaded and reset, the packet error count is not.
This can create a condition where the firmware could report an error like
the following if a channel was closed without any new errors:

  wctc4xxp 0000:07:08.0: 18446744073709551597 errored receive packets

wcdte.packet_errors is also renamed to wcdte.reported_packet_errors to not
conflict with the packet_errors member of the descriptor lists.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit d5f13c5116)
2015-06-04 15:26:58 -05:00
Russ Meyerriecks
62d7a00fdc wctc4xxp: Fix continuous "errored receive packets" with 2+ transcoders
In the case where two transcoders are loaded in a system and one transcoder
experiences an errored receive packet condition, the logic would ping pong the
error between the two cards, causing a runaway stream of errors in the kernel
log.

This fix moves the global error count var into the wcdte struct to allow for
per-card logic.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
(cherry picked from commit 4df03284a8)
2015-06-04 15:26:58 -05:00
Shaun Ruffell
5aaaaf9d2f dahdi: Remove IRQF_DISABLED.
The IRQF_DISABLED flag was removed in 4.1 in commit
"genirq: Remove the deprecated 'IRQF_DISABLED' request_irq() flag entirely" [1].

By default all interrupt handlers are now run with interrupts disabled and
therefore should all be considered "fast interrupts". Any driver that was still
using the flag will now lock interrupts directly in the handler in case running
on an older kernel that is not disabling interrupts when running the handler.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d8bf368d0631d4bc2612d8bf2e4e8e74e620d0cc

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit 8cd0823978)
2015-06-04 15:26:58 -05:00
Shaun Ruffell
f56b748f73 Remove DAHDI_IRQF_[SHARED|DISABLED] flags.
These flags are direct mappings to the IRQF_[SHARED|DISABLED] flags and no
longer need to be kept separate.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit 64a98af676)
2015-06-04 15:26:58 -05:00
John Sloan
4305b44108 wcxb: Fix "I/O error reported by firmware" followed by underruns
The cards affected include the TE131/3, TE235/435, A4B, and A8B.

Update all PCIe cards' firmware to increase the incoming and outgoing TDM FIFOs
to 16ms. The FIFOs will only be filled to a depth equal to the driver's latency
setting (ie. 3ms default). The total system latency is not effected. The
firmware and driver now also report the maximum DMA transaction time when in
DEBUG mode to aid in determining if the system is experiencing long PCIe
transactions (ie. TLP completion timeouts).

Decreased the maximum latency to from 20 to 12ms

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit ae5fa08abd)
2015-06-04 15:25:00 -05:00
Tzafrir Cohen
b6fe19cff5 xpp: USB_FW*: fix incorrect chan num with 2FXS6FXO
New USB firmware that fix mis-reporting of the number of channels (or
rather: licenses) in the Astribank when a 2FXS6FXO module is used in
conjunction with another module.

USB_FW.hex: rev. 11452
USB_FW.201.hex: rev. 11453

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
(cherry picked from commit 6287954087)
2015-06-04 15:25:00 -05:00
Tzafrir Cohen
108b0641aa README: use file time for reproducable build
https://bugs.debian.org/776622 asks to avoid using the build time in the
generated result to help make the build reproducable.

This fix uses the timestamp of README for generating the timestamp in
the footer of README.html.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
(cherry picked from commit b978e35636)
2015-06-04 15:25:00 -05:00
Tzafrir Cohen
368d8bec4b xpp: module_refcount is back to int on 3.19
Commit d5db139ab3764640e0882a1746e7b9fdee33fd87 "module: make
module_refcount() a signed integer." included in 3.19 makes this
condition slightly more complex.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
(cherry picked from commit 5c072d5bce)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
799753aefd dahdi: strnicmp() -> strncasecmp()
With commit (af3cd13501 "lib/string.c: remove strnicmp()") [1] dahdi can no
longer call strnicmp directly. strncasecmp was added into lib/string.c in kernel
version 2.6.22 so we'll map calls to strncasecmp to strnicmp for any kernel
before that.

This is necessary to compile against kernels >= 4.0.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=af3cd13501

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
(cherry picked from commit 1559db9d1a)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
a3da9f1d03 dahdi: Fix "void value not ignored..." error when compiling against kernel 4.0.
With commit (d1f1052c52 "device: Change dev_<level> logging functions to return
void") [1] in kernel version 4.0, DAHDI would fail to compile with the following
error:

  .../drivers/dahdi/dahdi-base.c:7150:2: error: void value not ignored as it ought to be
    dahdi_dev_dbg(ASSIGN, span_device(span),
    ^

Now ignore the dev_printk return value.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d1f1052c5204524

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
(cherry picked from commit 1cc0ad510a)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
701f633e0d dahdi: struct file.f_dentry macro was removed in kernel 3.19
This is necessary to build against kernel version 3.19 since commit
(78d28e651f97866d608d9b41 "kill f_dentry macro") [1]

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=78d28e651

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit 4d86a8f3f6)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
9d62e703fe dahdi_dynamic: Release reference count on network device when destroying dynamic spans.
It was reported that for VLAN interfaces, failing to release this reference
count will prevent a system from rebooting properly, resulting in the need to
power cycle.

Reported-by: Assen Totin
Internal-Issue-ID: DAHLIN-343
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit e005030995)
2015-06-04 15:25:00 -05:00
Tzafrir Cohen
6dd89a7ae5 xpp: firmware: a stray ^Z in FPGA_1161.201.hex
(cherry picked from commit ee691c23f4)
2015-06-04 15:25:00 -05:00
Tzafrir Cohen
0981935d5c xpp: firmware: 203 as alias to (newer) 201
Latest Astribank firmware (as of Rev. 11426 also supports some newer
hardware types, which will have the ID 203. Anyone installing this newer
version will now have 203 as an alias, but older versions will not have
it.

(cherry picked from commit 9698657f7a)
2015-06-04 15:25:00 -05:00
Tzafrir Cohen
cf057d4b0e xpp: FPGA_1161.201.hex: module types detection
New firmware that includes a better way to identify hardware modules
type that does not require multiplexers.

This is firmware file FPGA_1161.201.hex rev. 11426.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
(cherry picked from commit 79bf41ea8b)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
9769028667 build_tools/dkms-helper: Use bash to process dkms-helper script.
Looks like there are some bashims in the script. Make this explicit in the
script until they can be taken out.

This fixes failures to run this script on Ubuntu when dash is the default shell.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit 41b5353338)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
4f0cf5fb98 dahdi: smp_mb_{before,after}_clear_bit -> smp_mb_{before,after}_atomic.
This is needed to compile against upstream Linux 3.18 since commit
"locking: Remove deprecated smp_mb__() barriers" [1].

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2e39465abc4b7856a0ea6fcf4f

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit 378986841c)
2015-06-04 15:25:00 -05:00
Shaun Ruffell
c4356304e5 dahdi: Fix failure to read / write on kernel 3.16+
Kernel version 3.16+, since upstream commit (7f7f25e82d54870d "replace checking
for ->read/->aio_read presence with check in ->f_mode" )[1], does not like it
when dahdi changes the set of allowed file operations on a file descriptor
outside of the context of an open() system call.

DAHDI changes the available file operations when a channel is opened by first
opening /dev/dahdi/channel and then calling the DAHDI_SPECIFY ioctl to bind it
to a particular DAHDI channel. Until DAHDI_SPECIFY is called there weren't any
read()/write() callbacks implemented and therefore after the initial open, the
kernel was setting not setting FMODE_CAN_{WRITE,READ} on the file descriptor
indicating that those operations were not allowed.

Now define empty shell functions on the general dahdi_fops so the vfs layer will
not mark a file descriptor as unwritteable or unreadable on open.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7f7f25e82d54870df24d415a7007fbd327da027b

Internal-Issue-ID: DAHLIN-340
Reported-and-tested-by: Thomas B. Clark
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit b9a8000bbd)
2015-06-04 15:25:00 -05:00
Michael Walton
54893b93aa dynamic: Prevent oops due to inverted compile flag
The logic on ENABLE_TASKELETS compiler flag was inverted causing an oops on
normal dahdi_cfg of a dynamic span.

Issue-id: https://issues.asterisk.org/jira/browse/DAHLIN-328

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
(cherry picked from commit eedb4bf944)
2014-08-15 15:35:51 -05:00
7 changed files with 377 additions and 978 deletions

15
README
View File

@@ -12,16 +12,6 @@ Supported Hardware
------------------
Digital Cards
~~~~~~~~~~~~~
- wcte43x:
* Digium TE435: PCI express quad-port T1/E1/J1
* Digium TE436: PCI quad-port T1/E1/J1
* Digium TE235: PCI express dual-port T1/E1/J1
* Digium TE236: PCI dual-port T1/E1/J1
- wcte13xp:
* Digium TE131: PCI express single-port T1/E1/J1
* Digium TE133: PCI express single-port T1/E1/J1 with echocan
* Digium TE132: PCI single-port T1/E1/J1
* Digium TE134: PCI single-port T1/E1/J1 with echocan
- wct4xxp:
* Digium TE205P/TE207P/TE210P/TE212P: PCI dual-port T1/E1/J1
* Digium TE405P/TE407P/TE410P/TE412P: PCI quad-port T1/E1/J1
@@ -44,11 +34,6 @@ Digital Cards
Analog Cards
~~~~~~~~~~~~
- wcaxx:
* Digium A8A: PCI up to 8 mixed FXS/FXO ports
* Digium A8B: PCI express up to 8 mixed FXS/FXO ports
* Digium A4A: PCI up to 4 mixed FXS/FXO ports
* Digium A4B: PCI express up to 4 mixed FXS/FXO ports
- wctdm24xxp:
* Digium TDM2400P/AEX2400: up to 24 analog ports
* Digium TDM800P/AEX800: up to 8 analog ports

View File

@@ -2,18 +2,119 @@
if [ -f ${1}/.version ]; then
cat ${1}/.version
elif [ -f ${1}/.svnrevision ]; then
echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision`
elif [ -d ${1}/.svn ]; then
PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/${2}/:: | sed -e 's:/: :g'`
BRANCH=0
TEAM=0
REV=`svnversion -c ${1} | cut -d: -f2`
if [ "${PARTS}" = "trunk" ]
then
echo SVN-'trunk'-r${REV}
exit 0
fi
for PART in $PARTS
do
if [ ${BRANCH} != 0 ]
then
RESULT="${RESULT}-${PART}"
break
fi
if [ ${TEAM} != 0 ]
then
RESULT="${RESULT}-${PART}"
continue
fi
if [ "${PART}" = "branches" ]
then
BRANCH=1
RESULT="branch"
continue
fi
if [ "${PART}" = "tags" ]
then
BRANCH=1
RESULT="tag"
continue
fi
if [ "${PART}" = "team" ]
then
TEAM=1
continue
fi
done
echo SVN-${RESULT##-}-r${REV}
elif [ -d ${1}/.git ]; then
VERSION=`git describe --tags --dirty=M 2> /dev/null | sed -e "s/^v\([0-9]\)/\1/"`
if [ $? -ne 0 ]; then
MODIFIED=""
# If the first log commit messages indicates that this is checked into
# subversion, we'll just use the SVN- form of the revision.
MODIFIED=""
SVN_REV=`git log --pretty=full -1 | grep -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
if [ -z "$SVN_REV" ]; then
VERSION=`git describe --tags --dirty=M 2> /dev/null | sed -e "s/^v\([0-9]\)/\1/"`
if [ $? -ne 0 ]; then
if [ "`git ls-files -m | wc -l`" != "0" ]; then
MODIFIED="M"
fi
# Some older versions of git do not support all the above
# options.
VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED}
fi
echo ${VERSION}
else
PARTS=`LANG=C git log --pretty=full | grep -F "git-svn-id:" | head -1 | awk '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
BRANCH=0
TEAM=0
if [ "`git ls-files -m | wc -l`" != "0" ]; then
MODIFIED="M"
fi
# Some older versions of git do not support all the above
# options.
VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED}
if [ "${PARTS}" = "trunk" ]; then
echo SVN-'trunk'-r${SVN_REV}${MODIFIED}
exit 0
fi
for PART in $PARTS
do
if [ ${BRANCH} != 0 ]; then
RESULT="${RESULT}-${PART}"
break
fi
if [ ${TEAM} != 0 ]; then
RESULT="${RESULT}-${PART}"
continue
fi
if [ "${PART}" = "branches" ]; then
BRANCH=1
RESULT="branch"
continue
fi
if [ "${PART}" = "tags" ]; then
BRANCH=1
RESULT="tag"
continue
fi
if [ "${PART}" = "team" ]; then
TEAM=1
continue
fi
done
echo SVN-${RESULT##-}-r${SVN_REV}${MODIFIED}
fi
echo ${VERSION}
else
# Use the directory information in the absence of any other version
# information

View File

@@ -1,72 +0,0 @@
#!/bin/sh
MODULES="dahdi"
DAHDI_MODULES_FILE="/etc/dahdi/modules"
usage() {
cat <<EOF
$0: loads / unloads DAHDI kernel modules
Usage: $0 <load|unload>
* load: Loads all modules listed in /etc/dahdi/modules (one per line)
* unload: Unloads the DAHDI modules (all the modules that are dependencies
of $MODULES).
EOF
}
# recursively unload a module and its dependencies, if possible.
# where's modprobe -r when you need it?
# inputs: module to unload.
# returns: the result from
unload_module() {
module="$1"
line=`lsmod 2>/dev/null | grep "^$1 "`
if [ "$line" = '' ]; then return; fi # module was not loaded
set -- $line
# $1: the original module, $2: size, $3: refcount, $4: deps list
mods=`echo $4 | tr , ' '`
ec_modules=""
# xpp_usb keeps the xpds below busy if an xpp hardware is
# connected. Hence must be removed before them:
case "$module" in xpd_*) mods="xpp_usb $mods";; esac
for mod in $mods; do
case "$mod" in
dahdi_echocan_*)
ec_modules="$mod $ec_modules"
;;
*)
# run in a subshell, so it won't step over our vars:
(unload_module $mod)
;;
esac
done
# Now that all the other dependencies are unloaded, we can unload the
# dahdi_echocan modules. The drivers that register spans may keep
# references on the echocan modules before they are unloaded.
for mod in $ec_modules; do
(unload_module $mod)
done
rmmod $module
}
unload_modules() {
for module in "$@"; do
unload_module $module
done
}
load_modules() {
modules=`sed -e 's/#.*$//' $DAHDI_MODULES_FILE 2>/dev/null`
for line in $modules; do
modprobe $line
done
}
case "$1" in
load) load_modules "$@";;
unload) unload_modules $MODULES;;
*) usage;;
esac

View File

@@ -22,7 +22,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <dahdi/kernel.h>

File diff suppressed because it is too large Load Diff

View File

@@ -248,8 +248,8 @@
#define V_ROUT_TX_STIO2 (0x3 << 6) /* output data to STIO2 */
#define V_ROUT_RX_DIS (0x0 << 6) /* disabled, input data ignored */
#define V_ROUT_RX_LOOP (0x1 << 6) /* internally looped, input data ignored */
#define V_ROUT_RX_STIO2 (0x2 << 6) /* channel data from STIO2 */
#define V_ROUT_RX_STIO1 (0x3 << 6) /* channel data from STIO1 */
#define V_ROUT_RX_STIO2 (0x2 << 6) /* channel data comes from STIO1 */
#define V_ROUT_RX_STIO1 (0x3 << 6) /* channel data comes from STIO2 */
#define V_CH_SNUM_SHIFT (1)
#define V_CH_SNUM_MASK (31 << 1)
@@ -367,16 +367,6 @@
#define V_B2_RX_EN (1 << 1) /* 1=enable B2 RX */
#define V_ST_TRI (1 << 6) /* 1=tristate S/T output buffer */
/* User Flash Manager */
#define UFM_PROGRAM (1<<0)
#define UFM_ERASE (1<<1)
#define UFM_DRSHIFT (1<<2)
#define UFM_DRDIN (1<<3)
#define UFM_DRCLK (1<<4)
#define UFM_ARSHIFT (1<<5)
#define UFM_ARDIN (1<<6)
#define UFM_ARCLK (1<<7)
#define NUM_REGS 0xff
#define NUM_PCI 12
@@ -395,8 +385,7 @@
struct b4xxp_span {
struct b4xxp *parent;
int port; /* virtual port */
int phy_port; /* physical port */
int port; /* which S/T port this span belongs to */
unsigned char writechunk[WCB4XXP_CHANNELS_PER_SPAN * DAHDI_CHUNKSIZE];
unsigned char readchunk[WCB4XXP_CHANNELS_PER_SPAN * DAHDI_CHUNKSIZE];
@@ -437,9 +426,7 @@ enum cards_ids { /* Cards ==> Brand & Model */
BN4S0, /* Beronet BN4S0 */
BN8S0, /* BeroNet BN8S0 */
BSWYX_SX2, /* Swyx 4xS0 SX2 QuadBri */
QUADBRI_EVAL, /* HFC-4S CCD Eval. Board */
B430P, /* Digium B430P */
B230P /* Digium B230P */
QUADBRI_EVAL /* HFC-4S CCD Eval. Board */
};
/* This structure exists one per card */

View File

@@ -49,9 +49,7 @@ static DEF_PARM(int, debug, 0, 0644, "Print DBG statements");
static DEF_PARM(int, usb1, 0, 0644, "Allow using USB 1.1 interfaces");
static DEF_PARM(uint, tx_sluggish, 2000, 0644, "A sluggish transmit (usec)");
static DEF_PARM(uint, drop_pcm_after, 6, 0644,
"Number of consecutive tx_sluggish to start dropping PCM");
static DEF_PARM(uint, sluggish_pcm_keepalive, 50, 0644,
"During sluggish -- Keep-alive PCM (1 every #)");
"Number of consecutive tx_sluggish to drop a PCM frame");
#include "dahdi_debug.h"
@@ -119,8 +117,6 @@ enum {
XUSB_N_TX_FRAMES,
XUSB_N_RX_ERRORS,
XUSB_N_TX_ERRORS,
XUSB_N_RX_DROPS,
XUSB_N_TX_DROPS,
XUSB_N_RCV_ZERO_LEN,
};
@@ -131,14 +127,8 @@ enum {
static struct xusb_counters {
char *name;
} xusb_counters[] = {
C_(RX_FRAMES),
C_(TX_FRAMES),
C_(RX_ERRORS),
C_(TX_ERRORS),
C_(RX_DROPS),
C_(TX_DROPS),
C_(RCV_ZERO_LEN),
};
C_(RX_FRAMES), C_(TX_FRAMES), C_(RX_ERRORS), C_(TX_ERRORS),
C_(RCV_ZERO_LEN),};
#undef C_
@@ -204,7 +194,8 @@ struct xusb {
unsigned int max_tx_delay;
uint usb_tx_delay[NUM_BUCKETS];
uint sluggish_debounce;
bool drop_pcm; /* due to sluggishness */
bool drop_next_pcm; /* due to sluggishness */
atomic_t pcm_tx_drops;
atomic_t usb_sluggish_count;
const char *manufacturer;
@@ -409,23 +400,12 @@ static int xframe_send_pcm(xbus_t *xbus, xframe_t *xframe)
BUG_ON(!xframe);
xusb = xusb_of(xbus);
BUG_ON(!xusb);
if (xusb->drop_pcm) {
static int rate_limit;
if ((rate_limit++ % 1000) == 0)
XUSB_ERR(xusb, "Sluggish USB: drop tx-pcm (%d)\n",
rate_limit);
/* Let trickle of TX-PCM, so Astribank will not reset */
if (sluggish_pcm_keepalive &&
((rate_limit % sluggish_pcm_keepalive) != 0)) {
XUSB_COUNTER(xusb, TX_DROPS)++;
goto err;
}
if (xusb->drop_next_pcm) {
FREE_SEND_XFRAME(xbus, xframe); /* return to pool */
xusb->drop_next_pcm = 0;
return -EIO;
}
return do_send_xframe(xbus, xframe);
err:
FREE_SEND_XFRAME(xbus, xframe); /* return to pool */
return -EIO;
}
/*
@@ -694,6 +674,7 @@ static int xusb_probe(struct usb_interface *interface,
sema_init(&xusb->sem, 1);
atomic_set(&xusb->pending_writes, 0);
atomic_set(&xusb->pending_reads, 0);
atomic_set(&xusb->pcm_tx_drops, 0);
atomic_set(&xusb->usb_sluggish_count, 0);
xusb->udev = udev;
xusb->interface = interface;
@@ -897,6 +878,7 @@ static void xpp_send_callback(USB_PASS_CB(urb))
i = NUM_BUCKETS - 1;
xusb->usb_tx_delay[i]++;
if (unlikely(usec > tx_sluggish)) {
atomic_inc(&xusb->usb_sluggish_count);
if (xusb->sluggish_debounce++ > drop_pcm_after) {
static int rate_limit;
@@ -906,14 +888,12 @@ static void xpp_send_callback(USB_PASS_CB(urb))
"Sluggish USB. Dropping next PCM frame "
"(pending_writes=%d)\n",
writes);
atomic_inc(&xusb->usb_sluggish_count);
xusb->drop_pcm = 1;
atomic_inc(&xusb->pcm_tx_drops);
xusb->drop_next_pcm = 1;
xusb->sluggish_debounce = 0;
}
} else {
} else
xusb->sluggish_debounce = 0;
xusb->drop_pcm = 0;
}
/* sync/async unlink faults aren't errors */
if (urb->status
&& !(urb->status == -ENOENT || urb->status == -ECONNRESET)) {
@@ -976,26 +956,6 @@ static void xpp_receive_callback(USB_PASS_CB(urb))
// if (debug)
// dump_xframe("USB_FRAME_RECEIVE", xbus, xframe, debug);
XUSB_COUNTER(xusb, RX_FRAMES)++;
if (xusb->drop_pcm) {
/* some protocol analysis */
static int rate_limit;
xpacket_t *pack = (xpacket_t *)(xframe->packets);
bool is_pcm = XPACKET_IS_PCM(pack);
if (is_pcm) {
if ((rate_limit++ % 1000) == 0)
XUSB_ERR(xusb,
"Sluggish USB: drop rx-pcm (%d)\n",
rate_limit);
/* Let trickle of RX-PCM, so Astribank will not reset */
if (sluggish_pcm_keepalive &&
((rate_limit % sluggish_pcm_keepalive)
!= 0)) {
XUSB_COUNTER(xusb, RX_DROPS)++;
goto err;
}
}
}
/* Send UP */
xbus_receive_xframe(xbus, xframe);
end:
@@ -1101,16 +1061,17 @@ static int xusb_read_proc_show(struct seq_file *sfile, void *data)
stamp_last_pcm_read, accumulate_diff);
#endif
memcpy(usb_tx_delay, xusb->usb_tx_delay, sizeof(usb_tx_delay));
seq_printf(sfile, "usb_tx_delay[%dus - %dus]: ",
USEC_BUCKET * BUCKET_START,
USEC_BUCKET * NUM_BUCKETS);
seq_printf(sfile, "usb_tx_delay[%d,%d,%d]: ", USEC_BUCKET,
BUCKET_START, NUM_BUCKETS);
for (i = BUCKET_START; i < NUM_BUCKETS; i++) {
seq_printf(sfile, "%6d ", usb_tx_delay[i]);
if (i == mark_limit)
seq_printf(sfile, "| ");
}
seq_printf(sfile, "\nSluggish events: %d\n",
atomic_read(&xusb->usb_sluggish_count));
seq_printf(sfile, "\nPCM_TX_DROPS: %5d (sluggish: %d)\n",
atomic_read(&xusb->pcm_tx_drops),
atomic_read(&xusb->usb_sluggish_count)
);
seq_printf(sfile, "\nCOUNTERS:\n");
for (i = 0; i < XUSB_COUNTER_MAX; i++) {
seq_printf(sfile, "\t%-15s = %d\n", xusb_counters[i].name,