Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c840cf438 | ||
|
|
d228a12f1c | ||
|
|
6d4c748e04 | ||
|
|
4df746fe3f | ||
|
|
97e744ad96 | ||
|
|
90e8a54e3a | ||
|
|
26fb7c34cb | ||
|
|
34b9c77c9a | ||
|
|
c98f59eead | ||
|
|
ac300cd895 | ||
|
|
6e5197fed4 | ||
|
|
45ac6a30f9 | ||
|
|
d07c4545ec | ||
|
|
ffcd08205c | ||
|
|
8468250328 | ||
|
|
3e2eb9ca32 | ||
|
|
9991c959ef | ||
|
|
ac50b368aa | ||
|
|
db9c5f5c89 | ||
|
|
95fccc653c | ||
|
|
e93c53ce05 | ||
|
|
d9cf68685e | ||
|
|
4f3a724036 | ||
|
|
4af6f69fff | ||
|
|
cdd6ddd0fd | ||
|
|
02d30ab799 | ||
|
|
8c8b9b6df0 | ||
|
|
60aaff1289 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
|
||||
/.pc
|
||||
|
||||
.cache.mk
|
||||
*.[oa]
|
||||
*.mod
|
||||
*.mod.[oc]
|
||||
@@ -16,6 +17,7 @@ cscope.*
|
||||
*.symvers
|
||||
*.markers
|
||||
.*.o.d
|
||||
*.ur-safe
|
||||
|
||||
README.html
|
||||
modules.order
|
||||
|
||||
5
Makefile
5
Makefile
@@ -53,7 +53,7 @@ INST_HEADERS:=kernel.h user.h fasthdlc.h wctdm_user.h dahdi_config.h
|
||||
|
||||
DAHDI_BUILD_ALL:=m
|
||||
|
||||
KMAKE=+$(MAKE) -C $(KSRC) SUBDIRS=$(PWD)/drivers/dahdi DAHDI_INCLUDE=$(PWD)/include DAHDI_MODULES_EXTRA="$(DAHDI_MODULES_EXTRA)" HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
|
||||
KMAKE=+$(MAKE) -C $(KSRC) M=$(PWD)/drivers/dahdi DAHDI_INCLUDE=$(PWD)/include DAHDI_MODULES_EXTRA="$(DAHDI_MODULES_EXTRA)" HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE)
|
||||
|
||||
ROOT_PREFIX:=
|
||||
|
||||
@@ -102,6 +102,9 @@ install-modconf:
|
||||
/sbin/update-modules ; \
|
||||
fi
|
||||
|
||||
install-xpp-firm:
|
||||
$(MAKE) -C drivers/dahdi/xpp/firmwares install
|
||||
|
||||
|
||||
install-firmware:
|
||||
ifeq ($(HOTPLUG_FIRMWARE),yes)
|
||||
|
||||
57
docker-compose.yml
Normal file
57
docker-compose.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
version: '3'
|
||||
services:
|
||||
|
||||
test-centos7:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: test/docker/centos7
|
||||
volumes:
|
||||
- ./:/source
|
||||
network_mode: "host"
|
||||
security_opt:
|
||||
- label=type:container_runtime_t
|
||||
tty: true
|
||||
|
||||
test-centos6:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: test/docker/centos6
|
||||
volumes:
|
||||
- ./:/source
|
||||
network_mode: "host"
|
||||
security_opt:
|
||||
- label=type:container_runtime_t
|
||||
tty: true
|
||||
|
||||
test-debianstable:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: test/docker/debianstable
|
||||
volumes:
|
||||
- ./:/source
|
||||
network_mode: "host"
|
||||
security_opt:
|
||||
- label=type:container_runtime_t
|
||||
tty: true
|
||||
|
||||
test-debiantesting:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: test/docker/debiantesting
|
||||
volumes:
|
||||
- ./:/source
|
||||
network_mode: "host"
|
||||
security_opt:
|
||||
- label=type:container_runtime_t
|
||||
tty: true
|
||||
|
||||
test-fedorarawhide:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: test/docker/fedorarawhide
|
||||
volumes:
|
||||
- ./:/source
|
||||
network_mode: "host"
|
||||
security_opt:
|
||||
- label=type:container_runtime_t
|
||||
tty: true
|
||||
@@ -127,6 +127,7 @@ dahdi_vpmadt032_loader-objs := vpmadt032_loader/dahdi_vpmadt032_loader.o
|
||||
|
||||
ifneq ($(DAHDI_ARCH),)
|
||||
ifneq ($(wildcard $(src)/vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o_shipped),)
|
||||
$(shell touch $(KBUILD_EXTMOD)/vpmadt032_loader/.vpmadt032_$(DAHDI_ARCH).o.cmd)
|
||||
VPMADT032_LOADER_PRESENT=yes
|
||||
dahdi_vpmadt032_loader-objs += vpmadt032_loader/vpmadt032_$(DAHDI_ARCH).o
|
||||
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_VPMADT032_LOADER) += dahdi_vpmadt032_loader.o
|
||||
@@ -152,7 +153,7 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_ECHOCAN_HPEC) += dahdi_echocan_hpec.o
|
||||
endif
|
||||
|
||||
|
||||
hostprogs-y := makefw
|
||||
hostprogs := makefw
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -53,10 +53,6 @@
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
|
||||
#include <linux/smp_lock.h>
|
||||
#endif
|
||||
|
||||
#include <linux/ppp_defs.h>
|
||||
|
||||
#include <asm/atomic.h>
|
||||
@@ -103,11 +99,7 @@
|
||||
#define chan_to_netdev(h) ((h)->hdlcnetdev->netdev)
|
||||
|
||||
/* macro-oni for determining a unit (channel) number */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
#define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev)
|
||||
#else
|
||||
#define UNIT(file) MINOR(file->f_path.dentry->d_inode->i_rdev)
|
||||
#endif
|
||||
|
||||
EXPORT_SYMBOL(dahdi_transcode_fops);
|
||||
EXPORT_SYMBOL(dahdi_init_tone_state);
|
||||
@@ -202,7 +194,7 @@ static int maxlinks;
|
||||
|
||||
static struct core_timer {
|
||||
struct timer_list timer;
|
||||
struct timespec start_interval;
|
||||
ktime_t start_interval;
|
||||
unsigned long interval;
|
||||
int dahdi_receive_used;
|
||||
atomic_t count;
|
||||
@@ -1019,6 +1011,14 @@ static int dahdi_proc_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, dahdi_seq_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops dahdi_proc_ops = {
|
||||
.proc_open = dahdi_proc_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations dahdi_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = dahdi_proc_open,
|
||||
@@ -1026,6 +1026,7 @@ static const struct file_operations dahdi_proc_ops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1973,12 +1974,10 @@ static inline void print_debug_writebuf(struct dahdi_chan* ss, struct sk_buff *s
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DAHDI_NET
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26)
|
||||
static inline struct net_device_stats *hdlc_stats(struct net_device *dev)
|
||||
{
|
||||
return &dev->stats;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int dahdi_net_open(struct net_device *dev)
|
||||
{
|
||||
@@ -3938,19 +3937,11 @@ static void __dahdi_find_master_span(void)
|
||||
module_printk(KERN_NOTICE, "Master changed to %s\n", s->name);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void _dahdi_find_master_span(void *work)
|
||||
{
|
||||
__dahdi_find_master_span();
|
||||
}
|
||||
static DECLARE_WORK(find_master_work, _dahdi_find_master_span, NULL);
|
||||
#else
|
||||
static void _dahdi_find_master_span(struct work_struct *work)
|
||||
{
|
||||
__dahdi_find_master_span();
|
||||
}
|
||||
static DECLARE_WORK(find_master_work, _dahdi_find_master_span);
|
||||
#endif
|
||||
|
||||
static void dahdi_find_master_span(void)
|
||||
{
|
||||
@@ -4074,14 +4065,6 @@ dahdi_timer_unlocked_ioctl(struct file *file, unsigned int cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_UNLOCKED_IOCTL
|
||||
static int dahdi_timer_ioctl(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long data)
|
||||
{
|
||||
return dahdi_timer_unlocked_ioctl(file, cmd, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int dahdi_ioctl_getgains(struct file *file, unsigned long data)
|
||||
{
|
||||
int res = 0;
|
||||
@@ -4970,9 +4953,6 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
|
||||
chan->hdlcnetdev->netdev = alloc_hdlcdev(chan->hdlcnetdev);
|
||||
if (chan->hdlcnetdev->netdev) {
|
||||
chan->hdlcnetdev->chan = chan;
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 23)
|
||||
SET_MODULE_OWNER(chan->hdlcnetdev->netdev);
|
||||
#endif
|
||||
chan->hdlcnetdev->netdev->tx_queue_len = 50;
|
||||
#ifdef HAVE_NET_DEVICE_OPS
|
||||
chan->hdlcnetdev->netdev->netdev_ops = &dahdi_netdev_ops;
|
||||
@@ -7019,25 +6999,6 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef HAVE_UNLOCKED_IOCTL
|
||||
static int dahdi_ioctl(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long data)
|
||||
{
|
||||
return dahdi_unlocked_ioctl(file, cmd, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMPAT_IOCTL
|
||||
static long dahdi_ioctl_compat(struct file *file, unsigned int cmd,
|
||||
unsigned long data)
|
||||
{
|
||||
if (cmd == DAHDI_SFCONFIG)
|
||||
return -ENOTTY; /* Not supported yet */
|
||||
|
||||
return dahdi_unlocked_ioctl(file, cmd, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* _get_next_channo - Return the next taken channel number from the span list.
|
||||
* @span: The span with which to start the search.
|
||||
@@ -7455,7 +7416,7 @@ static int _dahdi_register_device(struct dahdi_device *ddev,
|
||||
__dahdi_init_span(s);
|
||||
}
|
||||
|
||||
ktime_get_ts(&ddev->registration_time);
|
||||
ddev->registration_time = ktime_get();
|
||||
ret = dahdi_sysfs_add_device(ddev, parent);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -7960,7 +7921,7 @@ static inline void __dahdi_process_getaudio_chunk(struct dahdi_chan *ss, unsigne
|
||||
memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short));
|
||||
txb[0] = DAHDI_LIN2X(0, ms);
|
||||
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
|
||||
/* fall through to normal conf mode */
|
||||
/* fallthrough */
|
||||
case DAHDI_CONF_CONF: /* Normal conference mode */
|
||||
if (is_pseudo_chan(ms)) /* if pseudo-channel */
|
||||
{
|
||||
@@ -8523,7 +8484,7 @@ static void __dahdi_hooksig_pvt(struct dahdi_chan *chan, enum dahdi_rxsig rxsig)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* fall through intentionally */
|
||||
/* fallthrough */
|
||||
case DAHDI_SIG_FXSGS: /* FXS Groundstart */
|
||||
if (rxsig == DAHDI_RXSIG_ONHOOK) {
|
||||
chan->ringdebtimer = RING_DEBOUNCE_TIME;
|
||||
@@ -8542,7 +8503,7 @@ static void __dahdi_hooksig_pvt(struct dahdi_chan *chan, enum dahdi_rxsig rxsig)
|
||||
chan->gotgs = 1;
|
||||
}
|
||||
}
|
||||
/* fall through intentionally */
|
||||
/* fallthrough */
|
||||
case DAHDI_SIG_FXOLS: /* FXO Loopstart */
|
||||
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
|
||||
switch(rxsig) {
|
||||
@@ -9384,11 +9345,7 @@ that the waitqueue is empty. */
|
||||
#ifdef CONFIG_DAHDI_NET
|
||||
if (skb && dahdi_have_netdev(ms))
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
|
||||
skb->mac.raw = skb->data;
|
||||
#else
|
||||
skb_reset_mac_header(skb);
|
||||
#endif
|
||||
skb->dev = chan_to_netdev(ms);
|
||||
#ifdef DAHDI_HDLC_TYPE_TRANS
|
||||
skb->protocol = hdlc_type_trans(skb,
|
||||
@@ -10046,24 +10003,6 @@ static void coretimer_cleanup(void)
|
||||
|
||||
#else
|
||||
|
||||
static unsigned long core_diff_ms(struct timespec *t0, struct timespec *t1)
|
||||
{
|
||||
long nanosec, sec;
|
||||
unsigned long ms;
|
||||
sec = (t1->tv_sec - t0->tv_sec);
|
||||
nanosec = (t1->tv_nsec - t0->tv_nsec);
|
||||
while (nanosec >= NSEC_PER_SEC) {
|
||||
nanosec -= NSEC_PER_SEC;
|
||||
++sec;
|
||||
}
|
||||
while (nanosec < 0) {
|
||||
nanosec += NSEC_PER_SEC;
|
||||
--sec;
|
||||
}
|
||||
ms = (sec * 1000) + (nanosec / 1000000L);
|
||||
return ms;
|
||||
}
|
||||
|
||||
static inline unsigned long msecs_processed(const struct core_timer *const ct)
|
||||
{
|
||||
return atomic_read(&ct->count) * DAHDI_MSECS_PER_CHUNK;
|
||||
@@ -10072,14 +10011,14 @@ static inline unsigned long msecs_processed(const struct core_timer *const ct)
|
||||
static void coretimer_func(TIMER_DATA_TYPE unused)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long ms_since_start;
|
||||
struct timespec now;
|
||||
long ms_since_start;
|
||||
ktime_t now;
|
||||
const unsigned long MAX_INTERVAL = 100000L;
|
||||
const unsigned long ONESEC_INTERVAL = HZ;
|
||||
const long MS_LIMIT = 3000;
|
||||
long difference;
|
||||
|
||||
ktime_get_ts(&now);
|
||||
now = ktime_get();
|
||||
|
||||
if (atomic_read(&core_timer.count) ==
|
||||
atomic_read(&core_timer.last_count)) {
|
||||
@@ -10097,7 +10036,7 @@ static void coretimer_func(TIMER_DATA_TYPE unused)
|
||||
core_timer.interval);
|
||||
}
|
||||
|
||||
ms_since_start = core_diff_ms(&core_timer.start_interval, &now);
|
||||
ms_since_start = ktime_ms_delta(now, core_timer.start_interval);
|
||||
|
||||
/*
|
||||
* If the system time has changed, it is possible for us to be
|
||||
@@ -10151,7 +10090,7 @@ static void coretimer_func(TIMER_DATA_TYPE unused)
|
||||
static void coretimer_init(void)
|
||||
{
|
||||
timer_setup(&core_timer.timer, coretimer_func, 0);
|
||||
ktime_get_ts(&core_timer.start_interval);
|
||||
core_timer.start_interval = ktime_get();
|
||||
atomic_set(&core_timer.count, 0);
|
||||
atomic_set(&core_timer.shutdown, 0);
|
||||
core_timer.interval = max(msecs_to_jiffies(DAHDI_MSECS_PER_CHUNK), 1UL);
|
||||
@@ -10313,14 +10252,7 @@ static const struct file_operations dahdi_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = dahdi_open,
|
||||
.release = dahdi_release,
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
.unlocked_ioctl = dahdi_unlocked_ioctl,
|
||||
#ifdef HAVE_COMPAT_IOCTL
|
||||
.compat_ioctl = dahdi_ioctl_compat,
|
||||
#endif
|
||||
#else
|
||||
.ioctl = dahdi_ioctl,
|
||||
#endif
|
||||
.poll = dahdi_poll,
|
||||
.read = dahdi_no_read,
|
||||
.write = dahdi_no_write,
|
||||
@@ -10329,14 +10261,7 @@ static const struct file_operations dahdi_fops = {
|
||||
static const struct file_operations dahdi_timer_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.release = dahdi_timer_release,
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
.unlocked_ioctl = dahdi_timer_unlocked_ioctl,
|
||||
#ifdef HAVE_COMPAT_IOCTL
|
||||
.compat_ioctl = dahdi_timer_unlocked_ioctl,
|
||||
#endif
|
||||
#else
|
||||
.ioctl = dahdi_timer_ioctl,
|
||||
#endif
|
||||
.poll = dahdi_timer_poll,
|
||||
.read = dahdi_no_read,
|
||||
.write = dahdi_no_write,
|
||||
@@ -10399,35 +10324,9 @@ nodev_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
|
||||
return nodev_common("ioctl");
|
||||
}
|
||||
|
||||
#ifndef HAVE_UNLOCKED_IOCTL
|
||||
static int nodev_ioctl(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long data)
|
||||
{
|
||||
return nodev_unlocked_ioctl(file, cmd, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMPAT_IOCTL
|
||||
static long nodev_ioctl_compat(struct file *file, unsigned int cmd,
|
||||
unsigned long data)
|
||||
{
|
||||
if (cmd == DAHDI_SFCONFIG)
|
||||
return -ENOTTY; /* Not supported yet */
|
||||
|
||||
return nodev_unlocked_ioctl(file, cmd, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct file_operations nodev_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
.unlocked_ioctl = nodev_unlocked_ioctl,
|
||||
#ifdef HAVE_COMPAT_IOCTL
|
||||
.compat_ioctl = nodev_ioctl_compat,
|
||||
#endif
|
||||
#else
|
||||
.ioctl = nodev_ioctl,
|
||||
#endif
|
||||
.read = nodev_chan_read,
|
||||
.write = nodev_chan_write,
|
||||
.poll = nodev_chan_poll,
|
||||
@@ -10437,14 +10336,7 @@ static const struct file_operations dahdi_chan_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = dahdi_open,
|
||||
.release = dahdi_release,
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
.unlocked_ioctl = dahdi_unlocked_ioctl,
|
||||
#ifdef HAVE_COMPAT_IOCTL
|
||||
.compat_ioctl = dahdi_ioctl_compat,
|
||||
#endif
|
||||
#else
|
||||
.ioctl = dahdi_ioctl,
|
||||
#endif
|
||||
.read = dahdi_chan_read,
|
||||
.write = dahdi_chan_write,
|
||||
.poll = dahdi_chan_poll,
|
||||
@@ -10550,35 +10442,10 @@ failed_driver_init:
|
||||
return res;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
|
||||
#ifdef CONFIG_PCI
|
||||
void dahdi_pci_disable_link_state(struct pci_dev *pdev, int state)
|
||||
{
|
||||
u16 reg16;
|
||||
int pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
|
||||
state &= (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
|
||||
PCIE_LINK_STATE_CLKPM);
|
||||
if (!pos)
|
||||
return;
|
||||
pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16);
|
||||
reg16 &= ~(state);
|
||||
pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
|
||||
}
|
||||
EXPORT_SYMBOL(dahdi_pci_disable_link_state);
|
||||
#endif /* CONFIG_PCI */
|
||||
#endif /* 2.6.25 */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
|
||||
static inline void flush_find_master_work(void)
|
||||
{
|
||||
flush_scheduled_work();
|
||||
}
|
||||
#else
|
||||
static inline void flush_find_master_work(void)
|
||||
{
|
||||
cancel_work_sync(&find_master_work);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void __exit dahdi_cleanup(void)
|
||||
{
|
||||
|
||||
@@ -33,9 +33,11 @@
|
||||
|
||||
/* shortcuts, for code readability */
|
||||
#define MAKE_DAHDI_DEV(num, name) \
|
||||
CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, num), NULL, name)
|
||||
device_create(dahdi_class, NULL, MKDEV(DAHDI_MAJOR, num), \
|
||||
NULL, "%s", name)
|
||||
|
||||
#define DEL_DAHDI_DEV(num) \
|
||||
CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, num))
|
||||
device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, num))
|
||||
|
||||
static struct class *dahdi_class;
|
||||
|
||||
|
||||
@@ -61,38 +61,6 @@ static inline struct dahdi_span *dev_to_span(struct device *dev)
|
||||
DAHDI_ADD_UEVENT_VAR("SPAN_NAME=%s", span->name); \
|
||||
} while (0)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
#define DAHDI_ADD_UEVENT_VAR(fmt, val...) \
|
||||
do { \
|
||||
int err = add_uevent_var(envp, num_envp, &i, \
|
||||
buffer, buffer_size, &len, \
|
||||
fmt, val); \
|
||||
if (err) \
|
||||
return err; \
|
||||
} while (0)
|
||||
|
||||
static int span_uevent(struct device *dev, char **envp, int num_envp,
|
||||
char *buffer, int buffer_size)
|
||||
{
|
||||
struct dahdi_span *span;
|
||||
int i = 0;
|
||||
int len = 0;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
span = dev_to_span(dev);
|
||||
if (!span)
|
||||
return -ENODEV;
|
||||
|
||||
dahdi_dbg(GENERAL, "SYFS dev_name=%s span=%s\n",
|
||||
dev_name(dev), span->name);
|
||||
SPAN_VAR_BLOCK;
|
||||
envp[i] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#define DAHDI_ADD_UEVENT_VAR(fmt, val...) \
|
||||
do { \
|
||||
int err = add_uevent_var(kenv, fmt, val); \
|
||||
@@ -115,8 +83,6 @@ static int span_uevent(struct device *dev, struct kobj_uevent_env *kenv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define span_attr(field, format_string) \
|
||||
static BUS_ATTR_READER(field##_show, dev, buf) \
|
||||
{ \
|
||||
@@ -465,37 +431,6 @@ static inline struct dahdi_device *to_ddev(struct device *dev)
|
||||
ddev->location); \
|
||||
} while (0)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
#define DAHDI_ADD_UEVENT_VAR(fmt, val...) \
|
||||
do { \
|
||||
int err = add_uevent_var(envp, num_envp, &i, \
|
||||
buffer, buffer_size, &len, \
|
||||
fmt, val); \
|
||||
if (err) \
|
||||
return err; \
|
||||
} while (0)
|
||||
|
||||
static int device_uevent(struct device *dev, char **envp, int num_envp,
|
||||
char *buffer, int buffer_size)
|
||||
{
|
||||
struct dahdi_device *ddev;
|
||||
int i = 0;
|
||||
int len = 0;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
ddev = to_ddev(dev);
|
||||
if (!ddev)
|
||||
return -ENODEV;
|
||||
|
||||
dahdi_dbg(GENERAL, "SYFS dev_name=%s\n", dev_name(dev));
|
||||
DEVICE_VAR_BLOCK;
|
||||
envp[i] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#define DAHDI_ADD_UEVENT_VAR(fmt, val...) \
|
||||
do { \
|
||||
int err = add_uevent_var(kenv, fmt, val); \
|
||||
@@ -517,8 +452,6 @@ static int device_uevent(struct device *dev, struct kobj_uevent_env *kenv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static ssize_t
|
||||
manufacturer_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
@@ -721,10 +654,11 @@ dahdi_registration_time_show(struct device *dev,
|
||||
{
|
||||
struct dahdi_device *ddev = to_ddev(dev);
|
||||
int count = 0;
|
||||
struct timespec64 ts = ktime_to_timespec64(ddev->registration_time);
|
||||
|
||||
count += sprintf(buf, "%010ld.%09ld\n",
|
||||
ddev->registration_time.tv_sec,
|
||||
ddev->registration_time.tv_nsec);
|
||||
count += sprintf(buf, "%010lld.%09ld\n",
|
||||
(s64)ts.tv_sec,
|
||||
ts.tv_nsec);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,29 +21,6 @@
|
||||
#define DRIVER_ATTR_READER(name, drv, buf) \
|
||||
ssize_t name(struct device_driver *drv, char * buf)
|
||||
|
||||
/* Device file creation macros */
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
||||
#define CLASS_DEV_CREATE(class, devt, device, name) \
|
||||
device_create(class, device, devt, NULL, "%s", name)
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
#define CLASS_DEV_CREATE(class, devt, device, name) \
|
||||
device_create(class, device, devt, name)
|
||||
#else
|
||||
#define CLASS_DEV_CREATE(class, devt, device, name) \
|
||||
class_device_create(class, NULL, devt, device, name)
|
||||
#endif
|
||||
|
||||
/* Device file destruction macros */
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
#define CLASS_DEV_DESTROY(class, devt) \
|
||||
device_destroy(class, devt)
|
||||
#else
|
||||
#define CLASS_DEV_DESTROY(class, devt) \
|
||||
class_device_destroy(class, devt)
|
||||
#endif
|
||||
|
||||
/* Global */
|
||||
int __init dahdi_sysfs_chan_init(const struct file_operations *fops);
|
||||
void dahdi_sysfs_chan_exit(void);
|
||||
|
||||
@@ -38,8 +38,7 @@
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if defined(CONFIG_HIGH_RES_TIMERS) && \
|
||||
LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
|
||||
#if defined(CONFIG_HIGH_RES_TIMERS)
|
||||
#define USE_HIGHRESTIMER
|
||||
#endif
|
||||
|
||||
@@ -50,9 +49,8 @@
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#if defined(USE_HIGHRESTIMER)
|
||||
#include <linux/hrtimer.h>
|
||||
#else
|
||||
#if !defined(USE_HIGHRESTIMER)
|
||||
#include <linux/timer.h>
|
||||
#endif
|
||||
|
||||
@@ -81,7 +79,7 @@ struct dahdi_dummy {
|
||||
struct dahdi_chan *chan;
|
||||
#if !defined(USE_HIGHRESTIMER)
|
||||
unsigned long calls_since_start;
|
||||
struct timespec start_interval;
|
||||
ktime_t start_interval;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -139,36 +137,19 @@ static enum hrtimer_restart dahdi_dummy_hr_int(struct hrtimer *htmr)
|
||||
return HRTIMER_RESTART;
|
||||
}
|
||||
#else
|
||||
static unsigned long timespec_diff_ms(struct timespec *t0, struct timespec *t1)
|
||||
{
|
||||
long nanosec, sec;
|
||||
unsigned long ms;
|
||||
sec = (t1->tv_sec - t0->tv_sec);
|
||||
nanosec = (t1->tv_nsec - t0->tv_nsec);
|
||||
while (nanosec >= NSEC_PER_SEC) {
|
||||
nanosec -= NSEC_PER_SEC;
|
||||
++sec;
|
||||
}
|
||||
while (nanosec < 0) {
|
||||
nanosec += NSEC_PER_SEC;
|
||||
--sec;
|
||||
}
|
||||
ms = (sec * 1000) + (nanosec / 1000000L);
|
||||
return ms;
|
||||
}
|
||||
|
||||
static void dahdi_dummy_timer(struct timer_timer *unused)
|
||||
static void dahdi_dummy_timer(TIMER_DATA_TYPE unused)
|
||||
{
|
||||
unsigned long ms_since_start;
|
||||
struct timespec now;
|
||||
const unsigned long MAX_INTERVAL = 100000L;
|
||||
const unsigned long MS_LIMIT = 3000;
|
||||
long ms_since_start;
|
||||
ktime_t now;
|
||||
const long MAX_INTERVAL = 100000L;
|
||||
const long MS_LIMIT = 3000;
|
||||
|
||||
if (!atomic_read(&shutdown))
|
||||
mod_timer(&timer, jiffies + JIFFIES_INTERVAL);
|
||||
|
||||
now = current_kernel_time();
|
||||
ms_since_start = timespec_diff_ms(&ztd->start_interval, &now);
|
||||
now = ktime_get();
|
||||
ms_since_start = ktime_ms_delta(now, ztd->start_interval);
|
||||
|
||||
/*
|
||||
* If the system time has changed, it is possible for us to be far
|
||||
@@ -258,8 +239,8 @@ int init_module(void)
|
||||
hrtimer_start(&zaptimer, ktime_set(0, DAHDI_TIME_NS), HRTIMER_MODE_REL);
|
||||
printk(KERN_INFO "dahdi_dummy: High Resolution Timer started, good to go\n");
|
||||
#else
|
||||
timer_setup(&timer, dahdi_dummy_timer);
|
||||
ztd->start_interval = current_kernel_time();
|
||||
timer_setup(&timer, dahdi_dummy_timer, 0);
|
||||
ztd->start_interval = ktime_get();
|
||||
atomic_set(&shutdown, 0);
|
||||
mod_timer(&timer, jiffies + JIFFIES_INTERVAL);
|
||||
#endif
|
||||
|
||||
@@ -80,11 +80,7 @@ static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
|
||||
{
|
||||
struct dahdi_span *span;
|
||||
struct ztdeth_header *zh;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
zh = (struct ztdeth_header *)skb_network_header(skb);
|
||||
#else
|
||||
zh = (struct ztdeth_header *)skb->nh.raw;
|
||||
#endif
|
||||
span = ztdeth_getspan(eth_hdr(skb)->h_source, zh->subaddr);
|
||||
if (span) {
|
||||
skb_pull(skb, sizeof(struct ztdeth_header));
|
||||
@@ -166,18 +162,9 @@ static void ztdeth_transmit(struct dahdi_dynamic *dyn, u8 *msg, size_t msglen)
|
||||
|
||||
/* Setup protocol and such */
|
||||
skb->protocol = __constant_htons(ETH_P_DAHDI_DETH);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
skb_set_network_header(skb, 0);
|
||||
#else
|
||||
skb->nh.raw = skb->data;
|
||||
#endif
|
||||
skb->dev = dev;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
||||
dev_hard_header(skb, dev, ETH_P_DAHDI_DETH, addr, dev->dev_addr, skb->len);
|
||||
#else
|
||||
if (dev->hard_header)
|
||||
dev->hard_header(skb, dev, ETH_P_DAHDI_DETH, addr, dev->dev_addr, skb->len);
|
||||
#endif
|
||||
skb_queue_tail(&skbs, skb);
|
||||
}
|
||||
}
|
||||
@@ -368,11 +355,7 @@ static int ztdeth_create(struct dahdi_dynamic *dyn, const char *addr)
|
||||
}
|
||||
z->subaddr = htons(sub);
|
||||
}
|
||||
z->dev = dev_get_by_name(
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
||||
&init_net,
|
||||
#endif
|
||||
z->ethdev);
|
||||
z->dev = dev_get_by_name(&init_net, z->ethdev);
|
||||
if (!z->dev) {
|
||||
printk(KERN_NOTICE "TDMoE: Invalid device '%s'\n", z->ethdev);
|
||||
kfree(z);
|
||||
|
||||
@@ -236,11 +236,7 @@ static int ztdethmf_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned int samples, channels, rbslen, flags;
|
||||
unsigned int skip = 0;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
|
||||
zh = (struct ztdeth_header *) skb_network_header(skb);
|
||||
#else
|
||||
zh = (struct ztdeth_header *) skb->nh.raw;
|
||||
#endif
|
||||
if (ntohs(zh->subaddr) & 0x8000) {
|
||||
/* got a multi-span frame */
|
||||
num_spans = ntohs(zh->subaddr) & 0xFF;
|
||||
@@ -484,19 +480,9 @@ static void ztdethmf_transmit(struct dahdi_dynamic *dyn, u8 *msg, size_t msglen)
|
||||
|
||||
/* Setup protocol type */
|
||||
skb->protocol = __constant_htons(ETH_P_ZTDETH);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
|
||||
skb_set_network_header(skb, 0);
|
||||
#else
|
||||
skb->nh.raw = skb->data;
|
||||
#endif
|
||||
skb->dev = dev;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
dev_hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len);
|
||||
#else
|
||||
if (dev->hard_header)
|
||||
dev->hard_header(skb, dev, ETH_P_ZTDETH, addr,
|
||||
dev->dev_addr, skb->len);
|
||||
#endif
|
||||
/* queue frame for delivery */
|
||||
if (dev) {
|
||||
skb_queue_tail(&skbs, skb);
|
||||
@@ -603,11 +589,7 @@ static int ztdethmf_create(struct dahdi_dynamic *dyn, const char *addr)
|
||||
kfree(z);
|
||||
return -EINVAL;
|
||||
}
|
||||
z->dev = dev_get_by_name(
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
&init_net,
|
||||
#endif
|
||||
z->ethdev);
|
||||
z->dev = dev_get_by_name(&init_net, z->ethdev);
|
||||
if (!z->dev) {
|
||||
printk(KERN_ERR "TDMoE Multiframe: Invalid device '%s'\n", z->ethdev);
|
||||
kfree(z);
|
||||
@@ -751,12 +733,22 @@ static int ztdethmf_proc_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, ztdethmf_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations ztdethmf_proc_fops = {
|
||||
.open = ztdethmf_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops ztdethmf_proc_fops = {
|
||||
.proc_open = ztdethmf_proc_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = seq_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations ztdethmf_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ztdethmf_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
#endif
|
||||
|
||||
static int __init ztdethmf_init(void)
|
||||
|
||||
@@ -397,13 +397,6 @@ static long dahdi_tc_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef HAVE_UNLOCKED_IOCTL
|
||||
static int dahdi_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
|
||||
{
|
||||
return (int)dahdi_tc_unlocked_ioctl(file, cmd, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned int dahdi_tc_poll(struct file *file, struct poll_table_struct *wait_table)
|
||||
{
|
||||
int ret;
|
||||
@@ -427,11 +420,7 @@ static struct file_operations __dahdi_transcode_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = dahdi_tc_open,
|
||||
.release = dahdi_tc_release,
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
.unlocked_ioctl = dahdi_tc_unlocked_ioctl,
|
||||
#else
|
||||
.ioctl = dahdi_tc_ioctl,
|
||||
#endif
|
||||
.read = dahdi_tc_read,
|
||||
.write = dahdi_tc_write,
|
||||
.poll = dahdi_tc_poll,
|
||||
|
||||
@@ -8,7 +8,7 @@ PWD=$(shell pwd)
|
||||
|
||||
MODULESO:=$(MODULES:%=%.o)
|
||||
MODULESKO:=$(MODULES:%=%.ko)
|
||||
KMAKE = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)
|
||||
KMAKE = $(MAKE) -C $(KSRC) M=$(PWD)
|
||||
KMAKE_INST = $(KMAKE) \
|
||||
INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/hrtimer.h>
|
||||
|
||||
#include <dahdi/kernel.h>
|
||||
|
||||
@@ -31,15 +32,11 @@
|
||||
UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime)
|
||||
{
|
||||
/* Why couldn't they just take a timeval like everyone else? */
|
||||
struct timeval tv;
|
||||
unsigned long long total_usecs;
|
||||
unsigned int mask = ~0;
|
||||
u64 total_usecs;
|
||||
|
||||
do_gettimeofday(&tv);
|
||||
total_usecs = (((unsigned long long)(tv.tv_sec)) * 1000000) +
|
||||
(((unsigned long long)(tv.tv_usec)));
|
||||
f_pTime->aulWallTimeUs[0] = (total_usecs & mask);
|
||||
f_pTime->aulWallTimeUs[1] = (total_usecs >> 32);
|
||||
total_usecs = ktime_to_us(ktime_get_real());
|
||||
f_pTime->aulWallTimeUs[0] = total_usecs;
|
||||
f_pTime->aulWallTimeUs[1] = total_usecs >> 32;
|
||||
return cOCT6100_ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,7 @@
|
||||
#include <linux/version.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
|
||||
#include <linux/semaphore.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
#endif
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <dahdi/kernel.h>
|
||||
@@ -380,15 +376,9 @@ static void update_channel_config(struct vpmadt032 *vpm, unsigned int channel,
|
||||
* the hardware can take some time while messages are sent to the VPMADT032
|
||||
* module and the driver waits for the responses.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void vpmadt032_bh(void *data)
|
||||
{
|
||||
struct vpmadt032 *vpm = data;
|
||||
#else
|
||||
static void vpmadt032_bh(struct work_struct *data)
|
||||
{
|
||||
struct vpmadt032 *vpm = container_of(data, struct vpmadt032, work);
|
||||
#endif
|
||||
struct change_order *order;
|
||||
|
||||
while ((order = get_next_order(vpm))) {
|
||||
@@ -514,11 +504,7 @@ vpmadt032_alloc(struct vpmadt032_options *options)
|
||||
sema_init(&vpm->sem, 1);
|
||||
vpm->curpage = 0x80;
|
||||
vpm->dspid = -1;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&vpm->work, vpmadt032_bh, vpm);
|
||||
#else
|
||||
INIT_WORK(&vpm->work, vpmadt032_bh);
|
||||
#endif
|
||||
|
||||
/* Do not use the global workqueue for processing these events. Some of
|
||||
* the operations can take 100s of ms, most of that time spent sleeping.
|
||||
|
||||
@@ -42,10 +42,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)
|
||||
#include <linux/semaphore.h>
|
||||
#endif
|
||||
|
||||
#include "gpakenum.h"
|
||||
#include "adt_lec.h"
|
||||
|
||||
@@ -1197,11 +1197,8 @@ voicebus_release(struct voicebus *vb)
|
||||
#endif
|
||||
|
||||
/* Make sure the underrun_work isn't running or going to run. */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
|
||||
flush_scheduled_work();
|
||||
#else
|
||||
cancel_work_sync(&vb->underrun_work);
|
||||
#endif
|
||||
|
||||
/* quiesce the hardware */
|
||||
voicebus_stop(vb);
|
||||
|
||||
@@ -1236,9 +1233,6 @@ vb_increase_latency(struct voicebus *vb, unsigned int increase,
|
||||
struct list_head *buffers)
|
||||
{
|
||||
struct vbb *vbb;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
|
||||
struct vbb *n;
|
||||
#endif
|
||||
int i;
|
||||
LIST_HEAD(local);
|
||||
|
||||
@@ -1274,12 +1268,7 @@ vb_increase_latency(struct voicebus *vb, unsigned int increase,
|
||||
}
|
||||
|
||||
handle_transmit(vb, &local);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
|
||||
list_for_each_entry_safe(vbb, n, &local, entry)
|
||||
list_move_tail(&vbb->entry, buffers);
|
||||
#else
|
||||
list_splice_tail(&local, buffers);
|
||||
#endif
|
||||
|
||||
/* Set the new latency (but we want to ensure that there aren't any
|
||||
* printks to the console, so we don't call the function) */
|
||||
@@ -1633,16 +1622,10 @@ tx_error_exit:
|
||||
* @work: The work_struct used to queue this function.
|
||||
*
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void handle_hardunderrun(void *data)
|
||||
{
|
||||
struct voicebus *vb = data;
|
||||
#else
|
||||
static void handle_hardunderrun(struct work_struct *work)
|
||||
{
|
||||
struct voicebus *vb = container_of(work, struct voicebus,
|
||||
underrun_work);
|
||||
#endif
|
||||
if (test_bit(VOICEBUS_STOP, &vb->flags) ||
|
||||
test_bit(VOICEBUS_STOPPED, &vb->flags))
|
||||
return;
|
||||
@@ -1677,11 +1660,7 @@ static void handle_hardunderrun(struct work_struct *work)
|
||||
* since it doesn't employ any locking on the voicebus interface.
|
||||
*/
|
||||
static irqreturn_t
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
vb_isr(int irq, void *dev_id, struct pt_regs *regs)
|
||||
#else
|
||||
vb_isr(int irq, void *dev_id)
|
||||
#endif
|
||||
{
|
||||
struct voicebus *vb = dev_id;
|
||||
unsigned long flags;
|
||||
@@ -1751,11 +1730,7 @@ vb_timer(TIMER_DATA_TYPE timer)
|
||||
{
|
||||
unsigned long start = jiffies;
|
||||
struct voicebus *vb = from_timer(vb, timer, timer);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
vb_isr(0, vb, 0);
|
||||
#else
|
||||
vb_isr(0, vb);
|
||||
#endif
|
||||
if (!test_bit(VOICEBUS_STOPPED, &vb->flags)) {
|
||||
mod_timer(&vb->timer, start + HZ/1000);
|
||||
}
|
||||
@@ -1803,11 +1778,7 @@ __voicebus_init(struct voicebus *vb, const char *board_name,
|
||||
timer_setup(&vb->timer, vb_timer, 0);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&vb->underrun_work, handle_hardunderrun, vb);
|
||||
#else
|
||||
INIT_WORK(&vb->underrun_work, handle_hardunderrun);
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
Configure the hardware / kernel module interfaces.
|
||||
|
||||
@@ -64,7 +64,11 @@
|
||||
* platform does not support it.
|
||||
*
|
||||
*/
|
||||
#undef CONFIG_VOICEBUS_DISABLE_ASPM
|
||||
#ifdef CONFIG_VOICEBUS_DISABLE_ASPM
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
|
||||
#include <linux/pci-aspm.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define this to use a FIFO for the software echocan reference.
|
||||
* (experimental) */
|
||||
@@ -173,9 +177,7 @@ struct voicebus {
|
||||
struct sk_buff_head captured_packets;
|
||||
struct net_device *netdev;
|
||||
struct net_device_stats net_stats;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
struct napi_struct napi;
|
||||
#endif
|
||||
atomic_t tx_seqnum;
|
||||
atomic_t rx_seqnum;
|
||||
#endif
|
||||
|
||||
@@ -104,26 +104,6 @@ static int vb_net_receive(struct voicebus *vb, int max)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
static int vb_net_poll(struct net_device *netdev, int *budget)
|
||||
{
|
||||
struct voicebus *vb = voicebus_from_netdev(netdev);
|
||||
int count = 0;
|
||||
int quota = min(netdev->quota, *budget);
|
||||
|
||||
count = vb_net_receive(vb, quota);
|
||||
|
||||
*budget -= count;
|
||||
netdev->quota -= count;
|
||||
|
||||
if (!skb_queue_len(&vb->captured_packets)) {
|
||||
netif_rx_complete(netdev);
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static int vb_net_poll(struct napi_struct *napi, int budget)
|
||||
{
|
||||
struct voicebus *vb = container_of(napi, struct voicebus, napi);
|
||||
@@ -142,7 +122,6 @@ static int vb_net_poll(struct napi_struct *napi, int budget)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void vb_net_set_multi(struct net_device *netdev)
|
||||
{
|
||||
@@ -155,11 +134,7 @@ static int vb_net_up(struct net_device *netdev)
|
||||
{
|
||||
struct voicebus *vb = voicebus_from_netdev(netdev);
|
||||
dev_dbg(&vb->pdev->dev, "%s\n", __func__);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netif_poll_enable(netdev);
|
||||
#else
|
||||
napi_enable(&vb->napi);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -167,11 +142,7 @@ static int vb_net_down(struct net_device *netdev)
|
||||
{
|
||||
struct voicebus *vb = voicebus_from_netdev(netdev);
|
||||
dev_dbg(&vb->pdev->dev, "%s\n", __func__);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netif_poll_disable(netdev);
|
||||
#else
|
||||
napi_disable(&vb->napi);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,12 +202,7 @@ int vb_net_register(struct voicebus *vb, const char *board_name)
|
||||
|
||||
netdev->promiscuity = 0;
|
||||
netdev->flags |= IFF_NOARP;
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netdev->poll = vb_net_poll;
|
||||
netdev->weight = 64;
|
||||
# else
|
||||
netif_napi_add(netdev, &vb->napi, vb_net_poll, 64);
|
||||
# endif
|
||||
|
||||
skb_queue_head_init(&vb->captured_packets);
|
||||
res = register_netdev(netdev);
|
||||
@@ -359,9 +325,7 @@ void vb_net_capture_vbb(struct voicebus *vb, const void *vbb, const int tx,
|
||||
return;
|
||||
|
||||
skb_queue_tail(&vb->captured_packets, skb);
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netif_rx_schedule(netdev);
|
||||
# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
netif_rx_schedule(netdev, &vb->napi);
|
||||
# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
|
||||
netif_rx_schedule(&vb->napi);
|
||||
|
||||
@@ -393,16 +393,10 @@ struct vpmoct_load_work {
|
||||
* long running firmware load.
|
||||
*
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void vpmoct_load_complete_fn(void *data)
|
||||
{
|
||||
struct vpmoct_load_work *work = data;
|
||||
#else
|
||||
static void vpmoct_load_complete_fn(struct work_struct *data)
|
||||
{
|
||||
struct vpmoct_load_work *work =
|
||||
container_of(data, struct vpmoct_load_work, work);
|
||||
#endif
|
||||
/* Do not touch work->vpm after calling load complete. It may have
|
||||
* been freed in the function by the board driver. */
|
||||
work->load_complete(work->vpm->dev, work->operational);
|
||||
@@ -421,11 +415,7 @@ vpmoct_load_complete(struct vpmoct_load_work *work, bool operational)
|
||||
{
|
||||
work->operational = operational;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&work->work, vpmoct_load_complete_fn, work);
|
||||
#else
|
||||
INIT_WORK(&work->work, vpmoct_load_complete_fn);
|
||||
#endif
|
||||
schedule_work(&work->work);
|
||||
}
|
||||
|
||||
@@ -490,16 +480,10 @@ static void vpmoct_release_firmware(const struct firmware *fw)
|
||||
* @vpm: The VPMOCT032 module to check / load.
|
||||
*
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void vpmoct_load_flash(void *data)
|
||||
{
|
||||
struct vpmoct_load_work *work = data;
|
||||
#else
|
||||
static void vpmoct_load_flash(struct work_struct *data)
|
||||
{
|
||||
struct vpmoct_load_work *work =
|
||||
container_of(data, struct vpmoct_load_work, work);
|
||||
#endif
|
||||
int res;
|
||||
struct vpmoct *const vpm = work->vpm;
|
||||
const struct firmware *fw;
|
||||
@@ -686,11 +670,7 @@ int vpmoct_init(struct vpmoct *vpm, load_complete_func_t load_complete)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&work->work, vpmoct_load_flash, work);
|
||||
#else
|
||||
INIT_WORK(&work->work, vpmoct_load_flash);
|
||||
#endif
|
||||
|
||||
work->vpm = vpm;
|
||||
work->load_complete = load_complete;
|
||||
|
||||
@@ -67,6 +67,12 @@
|
||||
#include "wcxb_spi.h"
|
||||
#include "wcxb_flash.h"
|
||||
|
||||
#ifdef CONFIG_VOICEBUS_DISABLE_ASPM
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
|
||||
#include <linux/pci-aspm.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Default ringer debounce (in ms)
|
||||
*/
|
||||
@@ -1446,11 +1452,13 @@ wcaxx_check_battery_lost(struct wcaxx *wc, struct wcaxx_module *const mod)
|
||||
break;
|
||||
case BATTERY_UNKNOWN:
|
||||
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
|
||||
/* fallthrough */
|
||||
case BATTERY_PRESENT:
|
||||
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
|
||||
fxo->battdebounce_timer = wc->framecount + battdebounce;
|
||||
break;
|
||||
case BATTERY_DEBOUNCING_LOST_FROM_PRESENT_ALARM:
|
||||
/* fallthrough */
|
||||
case BATTERY_DEBOUNCING_LOST: /* Intentional drop through */
|
||||
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
|
||||
if (debug) {
|
||||
@@ -1501,7 +1509,8 @@ wcaxx_check_battery_present(struct wcaxx *wc, struct wcaxx_module *const mod)
|
||||
|
||||
switch (fxo->battery_state) {
|
||||
case BATTERY_DEBOUNCING_PRESENT_FROM_LOST_ALARM:
|
||||
case BATTERY_DEBOUNCING_PRESENT: /* intentional drop through */
|
||||
/* fallthrough */
|
||||
case BATTERY_DEBOUNCING_PRESENT:
|
||||
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
|
||||
if (debug) {
|
||||
dev_info(&wc->xb.pdev->dev,
|
||||
@@ -1554,7 +1563,8 @@ wcaxx_check_battery_present(struct wcaxx *wc, struct wcaxx_module *const mod)
|
||||
break;
|
||||
case BATTERY_UNKNOWN:
|
||||
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
|
||||
case BATTERY_LOST: /* intentional drop through */
|
||||
/* fallthrough */
|
||||
case BATTERY_LOST:
|
||||
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
|
||||
fxo->battdebounce_timer = wc->framecount + battdebounce;
|
||||
break;
|
||||
@@ -4474,7 +4484,7 @@ static int __init wcaxx_init(void)
|
||||
if (!battthresh)
|
||||
battthresh = fxo_modes[_opermode].battthresh;
|
||||
|
||||
res = dahdi_pci_module(&wcaxx_driver);
|
||||
res = pci_register_driver(&wcaxx_driver);
|
||||
if (res)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -2963,7 +2963,7 @@ static void init_spans(struct b4xxp *b4)
|
||||
static void b4xxp_bottom_half(unsigned long data);
|
||||
|
||||
/* top-half interrupt handler */
|
||||
DAHDI_IRQ_HANDLER(b4xxp_interrupt)
|
||||
static irqreturn_t b4xxp_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct b4xxp *b4 = dev_id;
|
||||
unsigned char status;
|
||||
@@ -3672,7 +3672,7 @@ static int __init b4xx_init(void)
|
||||
printk(KERN_ERR "%s: ERROR: Could not initialize /proc/%s\n",THIS_MODULE->name, PROCFS_NAME);
|
||||
}
|
||||
#endif
|
||||
if (dahdi_pci_module(&b4xx_driver))
|
||||
if (pci_register_driver(&b4xx_driver))
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -48,16 +48,6 @@
|
||||
#include "wct4xxp.h"
|
||||
#include "vpm450m.h"
|
||||
|
||||
/* Work queues are a way to better distribute load on SMP systems */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
|
||||
/*
|
||||
* Work queues can significantly improve performance and scalability
|
||||
* on multi-processor machines, but requires bypassing some kernel
|
||||
* API's, so it's not guaranteed to be compatible with all kernels.
|
||||
*/
|
||||
/* #define ENABLE_WORKQUEUES */
|
||||
#endif
|
||||
|
||||
/* Support first generation cards? */
|
||||
#define SUPPORT_GEN1
|
||||
|
||||
@@ -79,88 +69,6 @@
|
||||
/* Maximum latency to be used with Gen 5 */
|
||||
#define GEN5_MAX_LATENCY 127
|
||||
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
#include <linux/cpu.h>
|
||||
|
||||
/* XXX UGLY!!!! XXX We have to access the direct structures of the workqueue which
|
||||
are only defined within workqueue.c because they don't give us a routine to allow us
|
||||
to nail a work to a particular thread of the CPU. Nailing to threads gives us substantially
|
||||
higher scalability in multi-CPU environments though! */
|
||||
|
||||
/*
|
||||
* The per-CPU workqueue (if single thread, we always use cpu 0's).
|
||||
*
|
||||
* The sequence counters are for flush_scheduled_work(). It wants to wait
|
||||
* until until all currently-scheduled works are completed, but it doesn't
|
||||
* want to be livelocked by new, incoming ones. So it waits until
|
||||
* remove_sequence is >= the insert_sequence which pertained when
|
||||
* flush_scheduled_work() was called.
|
||||
*/
|
||||
|
||||
struct cpu_workqueue_struct {
|
||||
|
||||
spinlock_t lock;
|
||||
|
||||
long remove_sequence; /* Least-recently added (next to run) */
|
||||
long insert_sequence; /* Next to add */
|
||||
|
||||
struct list_head worklist;
|
||||
wait_queue_head_t more_work;
|
||||
wait_queue_head_t work_done;
|
||||
|
||||
struct workqueue_struct *wq;
|
||||
task_t *thread;
|
||||
|
||||
int run_depth; /* Detect run_workqueue() recursion depth */
|
||||
} ____cacheline_aligned;
|
||||
|
||||
/*
|
||||
* The externally visible workqueue abstraction is an array of
|
||||
* per-CPU workqueues:
|
||||
*/
|
||||
struct workqueue_struct {
|
||||
/* TODO: Find out exactly where the API changed */
|
||||
struct cpu_workqueue_struct *cpu_wq;
|
||||
const char *name;
|
||||
struct list_head list; /* Empty if single thread */
|
||||
};
|
||||
|
||||
/* Preempt must be disabled. */
|
||||
static void __t4_queue_work(struct cpu_workqueue_struct *cwq,
|
||||
struct work_struct *work)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&cwq->lock, flags);
|
||||
work->wq_data = cwq;
|
||||
list_add_tail(&work->entry, &cwq->worklist);
|
||||
cwq->insert_sequence++;
|
||||
wake_up(&cwq->more_work);
|
||||
spin_unlock_irqrestore(&cwq->lock, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Queue work on a workqueue. Return non-zero if it was successfully
|
||||
* added.
|
||||
*
|
||||
* We queue the work to the CPU it was submitted, but there is no
|
||||
* guarantee that it will be processed by that CPU.
|
||||
*/
|
||||
static inline int t4_queue_work(struct workqueue_struct *wq, struct work_struct *work, int cpu)
|
||||
{
|
||||
int ret = 0;
|
||||
get_cpu();
|
||||
if (!test_and_set_bit(0, &work->pending)) {
|
||||
BUG_ON(!list_empty(&work->entry));
|
||||
__t4_queue_work(wq->cpu_wq + cpu, work);
|
||||
ret = 1;
|
||||
}
|
||||
put_cpu();
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define CONFIG_FORCE_EXTENDED_RESET to allow the qfalc framer extra time
|
||||
* to reset itself upon hardware initialization. This exits for rare
|
||||
@@ -179,6 +87,12 @@ static inline int t4_queue_work(struct workqueue_struct *wq, struct work_struct
|
||||
*/
|
||||
/* #define CONFIG_WCT4XXP_DISABLE_ASPM */
|
||||
|
||||
#ifdef CONFIG_WCT4XXP_DISABLE_ASPM
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
|
||||
#include <linux/pci-aspm.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FORCE_EXTENDED_RESET) && defined(CONFIG_NOEXTENDED_RESET)
|
||||
#error "You cannot define both CONFIG_FORCE_EXTENDED_RESET and " \
|
||||
"CONFIG_NOEXTENDED_RESET."
|
||||
@@ -324,9 +238,6 @@ struct t4_span {
|
||||
unsigned long dtmfmask;
|
||||
unsigned long dtmfmutemask;
|
||||
#endif
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
struct work_struct swork;
|
||||
#endif
|
||||
struct dahdi_chan *chans[32]; /* Individual channels */
|
||||
struct dahdi_echocan_state *ec[32]; /* Echocan state for each channel */
|
||||
};
|
||||
@@ -359,10 +270,6 @@ struct t4 {
|
||||
int spansstarted; /* number of spans started */
|
||||
u32 *writechunk; /* Double-word aligned write memory */
|
||||
u32 *readchunk; /* Double-word aligned read memory */
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
atomic_t worklist;
|
||||
struct workqueue_struct *workq;
|
||||
#endif
|
||||
int last0; /* for detecting double-missed IRQ */
|
||||
|
||||
/* DMA related fields */
|
||||
@@ -3195,19 +3102,6 @@ static inline void __transmit_span(struct t4_span *ts)
|
||||
_dahdi_transmit(&ts->span);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
static void workq_handlespan(void *data)
|
||||
{
|
||||
struct t4_span *ts = data;
|
||||
struct t4 *wc = ts->owner;
|
||||
|
||||
__receive_span(ts);
|
||||
__transmit_span(ts);
|
||||
atomic_dec(&wc->worklist);
|
||||
if (!atomic_read(&wc->worklist))
|
||||
t4_pci_out(wc, WC_INTR, 0);
|
||||
}
|
||||
#else
|
||||
static void t4_prep_gen2(struct t4 *wc)
|
||||
{
|
||||
int x;
|
||||
@@ -3219,7 +3113,6 @@ static void t4_prep_gen2(struct t4 *wc)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef SUPPORT_GEN1
|
||||
static void t4_transmitprep(struct t4 *wc, int irq)
|
||||
{
|
||||
@@ -3944,7 +3837,7 @@ static irqreturn_t _t4_interrupt(int irq, void *dev_id)
|
||||
return IRQ_RETVAL(1);
|
||||
}
|
||||
|
||||
DAHDI_IRQ_HANDLER(t4_interrupt)
|
||||
static irqreturn_t t4_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
irqreturn_t ret;
|
||||
unsigned long flags;
|
||||
@@ -4048,15 +3941,9 @@ static void t4_increase_latency(struct t4 *wc, int newlatency)
|
||||
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void t4_work_func(void *data)
|
||||
{
|
||||
struct t4 *wc = data;
|
||||
#else
|
||||
static void t4_work_func(struct work_struct *work)
|
||||
{
|
||||
struct t4 *wc = container_of(work, struct t4, bh_work);
|
||||
#endif
|
||||
|
||||
if (test_bit(T4_CHANGE_LATENCY, &wc->checkflag)) {
|
||||
if (wc->needed_latency != wc->numbufs) {
|
||||
@@ -4103,10 +3990,6 @@ static irqreturn_t _t4_interrupt_gen2(int irq, void *dev_id)
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
__t4_pci_out(wc, WC_INTR, status & 0x00000008);
|
||||
#endif
|
||||
|
||||
if (unlikely(!wc->spansstarted)) {
|
||||
dev_info(&wc->dev->dev, "Not prepped yet!\n");
|
||||
return IRQ_NONE;
|
||||
@@ -4169,28 +4052,6 @@ static irqreturn_t _t4_interrupt_gen2(int irq, void *dev_id)
|
||||
#endif
|
||||
|
||||
if (likely(status & 0x2)) {
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
int cpus = num_online_cpus();
|
||||
atomic_set(&wc->worklist, wc->numspans);
|
||||
if (wc->tspans[0]->span.flags & DAHDI_FLAG_RUNNING)
|
||||
t4_queue_work(wc->workq, &wc->tspans[0]->swork, 0);
|
||||
else
|
||||
atomic_dec(&wc->worklist);
|
||||
if (wc->tspans[1]->span.flags & DAHDI_FLAG_RUNNING)
|
||||
t4_queue_work(wc->workq, &wc->tspans[1]->swork, 1 % cpus);
|
||||
else
|
||||
atomic_dec(&wc->worklist);
|
||||
if (wc->numspans == 4) {
|
||||
if (wc->tspans[2]->span.flags & DAHDI_FLAG_RUNNING)
|
||||
t4_queue_work(wc->workq, &wc->tspans[2]->swork, 2 % cpus);
|
||||
else
|
||||
atomic_dec(&wc->worklist);
|
||||
if (wc->tspans[3]->span.flags & DAHDI_FLAG_RUNNING)
|
||||
t4_queue_work(wc->workq, &wc->tspans[3]->swork, 3 % cpus);
|
||||
else
|
||||
atomic_dec(&wc->worklist);
|
||||
}
|
||||
#else
|
||||
unsigned int reg5 = __t4_pci_in(wc, 5);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -4210,7 +4071,6 @@ static irqreturn_t _t4_interrupt_gen2(int irq, void *dev_id)
|
||||
t4_prep_gen2(wc);
|
||||
}
|
||||
|
||||
#endif
|
||||
t4_do_counters(wc);
|
||||
spin_lock(&wc->reglock);
|
||||
__handle_leds(wc);
|
||||
@@ -4265,14 +4125,11 @@ out:
|
||||
if (unlikely(test_bit(T4_CHANGE_LATENCY, &wc->checkflag) || test_bit(T4_CHECK_VPM, &wc->checkflag)))
|
||||
schedule_work(&wc->bh_work);
|
||||
|
||||
#ifndef ENABLE_WORKQUEUES
|
||||
__t4_pci_out(wc, WC_INTR, 0);
|
||||
#endif
|
||||
|
||||
return IRQ_RETVAL(1);
|
||||
}
|
||||
|
||||
DAHDI_IRQ_HANDLER(t4_interrupt_gen2)
|
||||
static irqreturn_t t4_interrupt_gen2(int irq, void *dev_id)
|
||||
{
|
||||
irqreturn_t ret;
|
||||
unsigned long flags;
|
||||
@@ -4934,9 +4791,6 @@ __t4_hardware_init_1(struct t4 *wc, unsigned int cardflags, bool first_time)
|
||||
if (debug) {
|
||||
dev_info(&wc->dev->dev, "Burst Mode: %s\n",
|
||||
(!(cardflags & FLAG_BURST) && noburst) ? "Off" : "On");
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
dev_info(&wc->dev->dev, "Work Queues: Enabled\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check the field updatable firmware for the wcte820 */
|
||||
@@ -5144,11 +4998,7 @@ static int __devinit t4_launch(struct t4 *wc)
|
||||
&wc->ddev->spans);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&wc->bh_work, t4_work_func, wc);
|
||||
#else
|
||||
INIT_WORK(&wc->bh_work, t4_work_func);
|
||||
#endif
|
||||
|
||||
res = dahdi_register_device(wc->ddev, &wc->dev->dev);
|
||||
if (res) {
|
||||
@@ -5299,15 +5149,6 @@ t4_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
wc->num = x;
|
||||
cards[x] = wc;
|
||||
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
if (wc->devtype->flags & FLAG_2NDGEN) {
|
||||
char tmp[20];
|
||||
|
||||
sprintf(tmp, "te%dxxp[%d]", wc->numspans, wc->num);
|
||||
wc->workq = create_workqueue(tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate pieces we need here */
|
||||
for (x = 0; x < ports_on_framer(wc); x++) {
|
||||
struct t4_span *ts;
|
||||
@@ -5320,9 +5161,6 @@ t4_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
}
|
||||
wc->tspans[x] = ts;
|
||||
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
INIT_WORK(&ts->swork, workq_handlespan, ts);
|
||||
#endif
|
||||
ts->spanflags |= wc->devtype->flags;
|
||||
linemode = (wc->t1e1 & (1 << x)) ? E1 : ((j1mode) ? J1 : T1);
|
||||
t4_alloc_channels(wc, wc->tspans[x], linemode);
|
||||
@@ -5462,13 +5300,6 @@ static void _t4_remove_one(struct t4 *wc)
|
||||
if (!(wc->tspans[0]->spanflags & FLAG_2NDGEN))
|
||||
basesize = basesize * 2;
|
||||
|
||||
#ifdef ENABLE_WORKQUEUES
|
||||
if (wc->workq) {
|
||||
flush_workqueue(wc->workq);
|
||||
destroy_workqueue(wc->workq);
|
||||
}
|
||||
#endif
|
||||
|
||||
free_irq(wc->dev->irq, wc);
|
||||
|
||||
if (wc->membase)
|
||||
@@ -5556,7 +5387,7 @@ static int __init t4_init(void)
|
||||
"Please use 'default_linemode' instead.\n");
|
||||
}
|
||||
|
||||
res = dahdi_pci_module(&t4_driver);
|
||||
res = pci_register_driver(&t4_driver);
|
||||
if (res)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -239,13 +239,8 @@ initialize_cmd(struct tcb *cmd, unsigned long cmd_flags)
|
||||
cmd->flags = cmd_flags;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
/*! Used to allocate commands to submit to the dte. */
|
||||
kmem_cache_t *cmd_cache;
|
||||
#else
|
||||
/*! Used to allocate commands to submit to the dte. */
|
||||
static struct kmem_cache *cmd_cache;
|
||||
#endif
|
||||
|
||||
static inline struct tcb *
|
||||
__alloc_cmd(size_t size, gfp_t alloc_flags, unsigned long cmd_flags)
|
||||
@@ -376,9 +371,7 @@ struct wcdte {
|
||||
struct sk_buff_head captured_packets;
|
||||
struct net_device *netdev;
|
||||
struct net_device_stats net_stats;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
|
||||
struct napi_struct napi;
|
||||
#endif
|
||||
struct timer_list watchdog;
|
||||
u16 open_channels;
|
||||
unsigned long reported_packet_errors;
|
||||
@@ -501,11 +494,7 @@ wctc4xxp_net_up(struct net_device *netdev)
|
||||
{
|
||||
struct wcdte *wc = wcdte_from_netdev(netdev);
|
||||
DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __func__);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netif_poll_enable(netdev);
|
||||
#else
|
||||
napi_enable(&wc->napi);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -514,11 +503,7 @@ wctc4xxp_net_down(struct net_device *netdev)
|
||||
{
|
||||
struct wcdte *wc = wcdte_from_netdev(netdev);
|
||||
DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __func__);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netif_poll_disable(netdev);
|
||||
#else
|
||||
napi_disable(&wc->napi);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -558,27 +543,6 @@ wctc4xxp_net_receive(struct wcdte *wc, int max)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
static int
|
||||
wctc4xxp_poll(struct net_device *netdev, int *budget)
|
||||
{
|
||||
struct wcdte *wc = wcdte_from_netdev(netdev);
|
||||
int count = 0;
|
||||
int quota = min(netdev->quota, *budget);
|
||||
|
||||
count = wctc4xxp_net_receive(wc, quota);
|
||||
|
||||
*budget -= count;
|
||||
netdev->quota -= count;
|
||||
|
||||
if (!skb_queue_len(&wc->captured_packets)) {
|
||||
netif_rx_complete(netdev);
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static int
|
||||
wctc4xxp_poll(struct napi_struct *napi, int budget)
|
||||
{
|
||||
@@ -598,7 +562,6 @@ wctc4xxp_poll(struct napi_struct *napi, int budget)
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct net_device_stats *
|
||||
wctc4xxp_net_get_stats(struct net_device *netdev)
|
||||
@@ -690,12 +653,7 @@ wctc4xxp_net_register(struct wcdte *wc)
|
||||
netdev->promiscuity = 0;
|
||||
netdev->flags |= IFF_NOARP;
|
||||
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netdev->poll = &wctc4xxp_poll;
|
||||
netdev->weight = 64;
|
||||
# else
|
||||
netif_napi_add(netdev, &wc->napi, &wctc4xxp_poll, 64);
|
||||
# endif
|
||||
|
||||
res = register_netdev(netdev);
|
||||
if (res) {
|
||||
@@ -765,9 +723,7 @@ wctc4xxp_net_capture_cmd(struct wcdte *wc, const struct tcb *cmd)
|
||||
return;
|
||||
|
||||
skb_queue_tail(&wc->captured_packets, skb);
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
netif_rx_schedule(netdev);
|
||||
# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
|
||||
netif_rx_schedule(netdev, &wc->napi);
|
||||
# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
|
||||
netif_rx_schedule(&wc->napi);
|
||||
@@ -1977,13 +1933,9 @@ wctc4xxp_operation_allocate(struct dahdi_transcoder_channel *dtc)
|
||||
int res = 0;
|
||||
struct wcdte *wc = ((struct channel_pvt *)(dtc->pvt))->wc;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
mutex_lock(&wc->chanlock);
|
||||
#else
|
||||
res = mutex_lock_killable(&wc->chanlock);
|
||||
if (res)
|
||||
return res;
|
||||
#endif
|
||||
|
||||
++wc->open_channels;
|
||||
|
||||
@@ -2056,13 +2008,9 @@ wctc4xxp_operation_release(struct dahdi_transcoder_channel *dtc)
|
||||
BUG_ON(!cpvt);
|
||||
BUG_ON(!wc);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
mutex_lock(&wc->chanlock);
|
||||
#else
|
||||
res = mutex_lock_killable(&wc->chanlock);
|
||||
if (res)
|
||||
return res;
|
||||
#endif
|
||||
|
||||
if (test_bit(DTE_SHUTDOWN, &wc->flags)) {
|
||||
/* On shutdown, if we reload the firmware we will reset the
|
||||
@@ -2777,19 +2725,13 @@ static void service_rx_ring(struct wcdte *wc)
|
||||
wctc4xxp_receive_demand_poll(wc);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void deferred_work_func(void *param)
|
||||
{
|
||||
struct wcdte *wc = param;
|
||||
#else
|
||||
static void deferred_work_func(struct work_struct *work)
|
||||
{
|
||||
struct wcdte *wc = container_of(work, struct wcdte, deferred_work);
|
||||
#endif
|
||||
service_rx_ring(wc);
|
||||
}
|
||||
|
||||
DAHDI_IRQ_HANDLER(wctc4xxp_interrupt)
|
||||
static irqreturn_t wctc4xxp_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct wcdte *wc = dev_id;
|
||||
bool packets_to_process = false;
|
||||
@@ -3902,16 +3844,11 @@ static ssize_t wctc4xxp_force_alert_store(struct device *dev,
|
||||
}
|
||||
|
||||
dev_info(&wc->pdev->dev, "Forcing alert type: 0x%x\n", alert_type);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
mutex_lock(&wc->chanlock);
|
||||
#else
|
||||
res = mutex_lock_killable(&wc->chanlock);
|
||||
if (res) {
|
||||
free_cmd(cmd);
|
||||
return -EAGAIN;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
parameters[0] = alert_type;
|
||||
|
||||
@@ -4000,11 +3937,7 @@ wctc4xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
INIT_LIST_HEAD(&wc->cmd_list);
|
||||
INIT_LIST_HEAD(&wc->waiting_for_response_list);
|
||||
INIT_LIST_HEAD(&wc->rx_list);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&wc->deferred_work, deferred_work_func, wc);
|
||||
#else
|
||||
INIT_WORK(&wc->deferred_work, deferred_work_func);
|
||||
#endif
|
||||
init_waitqueue_head(&wc->waitq);
|
||||
|
||||
if (pci_set_dma_mask(wc->pdev, DMA_BIT_MASK(32))) {
|
||||
@@ -4295,25 +4228,15 @@ static int __init wctc4xxp_init(void)
|
||||
int res;
|
||||
unsigned long cache_flags;
|
||||
|
||||
#if defined(CONFIG_SLUB) && (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 22))
|
||||
cache_flags = SLAB_HWCACHE_ALIGN | SLAB_STORE_USER | SLAB_DEBUG_FREE;
|
||||
#else
|
||||
cache_flags = SLAB_HWCACHE_ALIGN;
|
||||
#endif
|
||||
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
|
||||
cmd_cache = kmem_cache_create(THIS_MODULE->name, sizeof(struct tcb),
|
||||
0, cache_flags, NULL, NULL);
|
||||
# else
|
||||
cmd_cache = kmem_cache_create(THIS_MODULE->name, sizeof(struct tcb),
|
||||
0, cache_flags, NULL);
|
||||
# endif
|
||||
|
||||
if (!cmd_cache)
|
||||
return -ENOMEM;
|
||||
spin_lock_init(&wctc4xxp_list_lock);
|
||||
INIT_LIST_HEAD(&wctc4xxp_list);
|
||||
res = dahdi_pci_module(&wctc4xxp_driver);
|
||||
res = pci_register_driver(&wctc4xxp_driver);
|
||||
if (res) {
|
||||
kmem_cache_destroy(cmd_cache);
|
||||
return -ENODEV;
|
||||
|
||||
@@ -50,11 +50,7 @@ Tx Gain - W/Pre-Emphasis: -23.99 to 0.00 db
|
||||
#include <linux/delay.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/firmware.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
|
||||
#include <linux/semaphore.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
#endif
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
@@ -332,15 +328,9 @@ struct bg {
|
||||
int ret;
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void bg_work_func(void *data)
|
||||
{
|
||||
struct bg *bg = data;
|
||||
#else
|
||||
static void bg_work_func(struct work_struct *work)
|
||||
{
|
||||
struct bg *bg = container_of(work, struct bg, work);
|
||||
#endif
|
||||
bg->ret = bg->fn(bg->wc, bg->param);
|
||||
complete(&bg->complete);
|
||||
}
|
||||
@@ -377,11 +367,7 @@ bg_create(struct wctdm *wc, bg_work_func_t fn, unsigned long param)
|
||||
}
|
||||
|
||||
init_completion(&bg->complete);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&bg->work, bg_work_func, bg);
|
||||
#else
|
||||
INIT_WORK(&bg->work, bg_work_func);
|
||||
#endif
|
||||
|
||||
bg->wc = wc;
|
||||
bg->fn = fn;
|
||||
@@ -463,16 +449,10 @@ struct vpmadt032_channel_setup {
|
||||
struct wctdm *wc;
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void vpm_setup_work_func(void *data)
|
||||
{
|
||||
struct vpmadt032_channel_setup *setup = data;
|
||||
#else
|
||||
static void vpm_setup_work_func(struct work_struct *work)
|
||||
{
|
||||
struct vpmadt032_channel_setup *setup =
|
||||
container_of(work, struct vpmadt032_channel_setup, work);
|
||||
#endif
|
||||
int i;
|
||||
int res;
|
||||
GpakChannelConfig_t chanconfig;
|
||||
@@ -634,13 +614,7 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct wctdm *wc)
|
||||
return -ENOMEM;
|
||||
|
||||
setup->wc = wc;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&setup->work, vpm_setup_work_func, setup);
|
||||
#else
|
||||
INIT_WORK(&setup->work, vpm_setup_work_func);
|
||||
#endif
|
||||
|
||||
queue_work(vpm->wq, &setup->work);
|
||||
|
||||
return 0;
|
||||
@@ -1981,12 +1955,14 @@ wctdm_check_battery_lost(struct wctdm *wc, struct wctdm_module *const mod)
|
||||
break;
|
||||
case BATTERY_UNKNOWN:
|
||||
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
|
||||
/* fallthrough */
|
||||
case BATTERY_PRESENT:
|
||||
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
|
||||
fxo->battdebounce_timer = wc->framecount + battdebounce;
|
||||
break;
|
||||
case BATTERY_DEBOUNCING_LOST_FROM_PRESENT_ALARM:
|
||||
case BATTERY_DEBOUNCING_LOST: /* Intentional drop through */
|
||||
/* fallthrough */
|
||||
case BATTERY_DEBOUNCING_LOST:
|
||||
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
|
||||
if (debug) {
|
||||
dev_info(&wc->vb.pdev->dev,
|
||||
@@ -2089,7 +2065,8 @@ wctdm_check_battery_present(struct wctdm *wc, struct wctdm_module *const mod)
|
||||
break;
|
||||
case BATTERY_UNKNOWN:
|
||||
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
|
||||
case BATTERY_LOST: /* intentional drop through */
|
||||
/* fallthrough */
|
||||
case BATTERY_LOST:
|
||||
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
|
||||
fxo->battdebounce_timer = wc->framecount + battdebounce;
|
||||
break;
|
||||
@@ -6128,7 +6105,7 @@ static int __init wctdm_init(void)
|
||||
|
||||
b400m_module_init();
|
||||
|
||||
res = dahdi_pci_module(&wctdm_driver);
|
||||
res = pci_register_driver(&wctdm_driver);
|
||||
if (res)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -29,11 +29,7 @@
|
||||
#include <dahdi/kernel.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
|
||||
#include <linux/semaphore.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
#endif
|
||||
|
||||
#include "voicebus/voicebus.h"
|
||||
|
||||
|
||||
@@ -2386,15 +2386,9 @@ int b400m_dchan(struct dahdi_span *span)
|
||||
|
||||
/*
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void xhfc_work(void *data)
|
||||
{
|
||||
struct b400m *b4 = data;
|
||||
#else
|
||||
static void xhfc_work(struct work_struct *work)
|
||||
{
|
||||
struct b400m *b4 = container_of(work, struct b400m, xhfc_wq);
|
||||
#endif
|
||||
int i, j, k, fifo;
|
||||
unsigned char b, b2;
|
||||
|
||||
@@ -2564,9 +2558,10 @@ static int b400m_probe(struct wctdm *wc, int modpos)
|
||||
struct b400m *b4;
|
||||
unsigned long flags;
|
||||
int chiprev;
|
||||
u8 lastreg = 0;
|
||||
|
||||
wctdm_setreg(wc, &wc->mods[modpos], 0x10, 0x10);
|
||||
id = xhfc_getreg(wc, &wc->mods[modpos], R_CHIP_ID, &x);
|
||||
id = xhfc_getreg(wc, &wc->mods[modpos], R_CHIP_ID, &lastreg);
|
||||
|
||||
/* chip ID high 7 bits must be 0x62, see datasheet */
|
||||
if ((id & 0xfe) != 0x62)
|
||||
@@ -2581,6 +2576,7 @@ static int b400m_probe(struct wctdm *wc, int modpos)
|
||||
|
||||
/* card found, enabled and main struct allocated. Fill it out. */
|
||||
b4->wc = wc;
|
||||
b4->lastreg = lastreg;
|
||||
b4->position = modpos;
|
||||
|
||||
/* which B400M in the system is this one? count all of them found so
|
||||
@@ -2630,11 +2626,7 @@ void b400m_post_init(struct b400m *b4)
|
||||
snprintf(b4->name, sizeof(b4->name) - 1, "b400m-%d",
|
||||
b4->b400m_no);
|
||||
b4->xhfc_ws = create_singlethread_workqueue(b4->name);
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&b4->xhfc_wq, xhfc_work, b4);
|
||||
# else
|
||||
INIT_WORK(&b4->xhfc_wq, xhfc_work);
|
||||
# endif
|
||||
b4->inited = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1872,9 +1872,10 @@ static int t13x_set_linemode(struct dahdi_span *span, enum spantypes linemode)
|
||||
break;
|
||||
case SPANTYPE_DIGITAL_J1:
|
||||
dev_info(&wc->xb.pdev->dev,
|
||||
"Changing from %s to E1 line mode.\n",
|
||||
"Changing from %s to J1 line mode.\n",
|
||||
dahdi_spantype2str(wc->span.spantype));
|
||||
res = t13x_software_init(wc, J1);
|
||||
break;
|
||||
default:
|
||||
dev_err(&wc->xb.pdev->dev,
|
||||
"Got invalid linemode '%s' from dahdi\n",
|
||||
@@ -2272,15 +2273,9 @@ static void te13x_handle_transmit(struct wcxb *xb, void *vfp)
|
||||
#define SPAN_ALARMS \
|
||||
(wc->span.alarms & ~DAHDI_ALARM_NOTOPEN)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void timer_work_func(void *param)
|
||||
{
|
||||
struct t13x *wc = param;
|
||||
#else
|
||||
static void timer_work_func(struct work_struct *work)
|
||||
{
|
||||
struct t13x *wc = container_of(work, struct t13x, timer_work);
|
||||
#endif
|
||||
static int work_count;
|
||||
|
||||
if (debug)
|
||||
@@ -2585,11 +2580,7 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev,
|
||||
mutex_init(&wc->lock);
|
||||
timer_setup(&wc->timer, te13xp_timer, 0);
|
||||
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&wc->timer_work, timer_work_func, wc);
|
||||
# else
|
||||
INIT_WORK(&wc->timer_work, timer_work_func);
|
||||
# endif
|
||||
|
||||
wc->ddev = dahdi_create_device();
|
||||
if (!wc->ddev) {
|
||||
@@ -2798,7 +2789,7 @@ static int __init te13xp_init(void)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
res = dahdi_pci_module(&te13xp_driver);
|
||||
res = pci_register_driver(&te13xp_driver);
|
||||
if (res)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -55,19 +55,6 @@
|
||||
#include "wcxb_spi.h"
|
||||
#include "wcxb_flash.h"
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
# ifdef RHEL_RELEASE_VERSION
|
||||
# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 6)
|
||||
# define T43X_HAVE_CANCEL_WORK_SYNC
|
||||
# endif
|
||||
# else
|
||||
static inline int delayed_work_pending(struct work_struct *work)
|
||||
{
|
||||
return test_bit(0, &work->pending);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static const char *TE435_FW_FILENAME = "dahdi-fw-te435.bin";
|
||||
static const char *TE436_FW_FILENAME = "dahdi-fw-te436.bin";
|
||||
static const u32 TE435_VERSION = 0x13001e;
|
||||
@@ -120,11 +107,7 @@ struct t43x_span {
|
||||
};
|
||||
|
||||
struct t43x_clksrc_work {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
struct work_struct work;
|
||||
#else
|
||||
struct delayed_work work;
|
||||
#endif
|
||||
spinlock_t lock;
|
||||
enum wcxb_clock_sources clksrc;
|
||||
bool is_timing_master;
|
||||
@@ -1191,16 +1174,10 @@ static void __t43x_set_rclk_src(struct t43x *wc, int span)
|
||||
|
||||
/* This is called from the workqueue to wait for the TDM engine stop */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void t43x_clksrc_work_fn(void *data)
|
||||
{
|
||||
struct t43x_clksrc_work *work = data;
|
||||
#else
|
||||
static void t43x_clksrc_work_fn(struct work_struct *data)
|
||||
{
|
||||
struct t43x_clksrc_work *work = container_of(to_delayed_work(data),
|
||||
struct t43x_clksrc_work, work);
|
||||
#endif
|
||||
struct t43x_clksrc_work *work = container_of(data,
|
||||
struct t43x_clksrc_work, work.work);
|
||||
struct t43x *wc = container_of(work, struct t43x, clksrc_work);
|
||||
|
||||
if (debug) {
|
||||
@@ -2029,16 +2006,10 @@ struct maint_work_struct {
|
||||
struct dahdi_span *span;
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void t43x_maint_work(void *data)
|
||||
{
|
||||
struct maint_work_struct *w = data;
|
||||
#else
|
||||
static void t43x_maint_work(struct work_struct *work)
|
||||
{
|
||||
struct maint_work_struct *w = container_of(work,
|
||||
struct maint_work_struct, work);
|
||||
#endif
|
||||
|
||||
struct t43x *wc = w->wc;
|
||||
struct dahdi_span *span = w->span;
|
||||
@@ -2289,11 +2260,7 @@ static int t43x_maint(struct dahdi_span *span, int cmd)
|
||||
work->wc = wc;
|
||||
work->cmd = cmd;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&work->work, t43x_maint_work, work);
|
||||
#else
|
||||
INIT_WORK(&work->work, t43x_maint_work);
|
||||
#endif
|
||||
queue_work(wc->wq, &work->work);
|
||||
return 0;
|
||||
}
|
||||
@@ -3075,15 +3042,9 @@ static void t43x_handle_transmit(struct wcxb *xb, void *vfp)
|
||||
#define SPAN_ALARMS \
|
||||
(ts->span.alarms & ~DAHDI_ALARM_NOTOPEN)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void timer_work_func(void *param)
|
||||
{
|
||||
struct t43x *wc = param;
|
||||
#else
|
||||
static void timer_work_func(struct work_struct *work)
|
||||
{
|
||||
struct t43x *wc = container_of(work, struct t43x, timer_work);
|
||||
#endif
|
||||
struct t43x_span *ts;
|
||||
int x;
|
||||
bool start_timer = false;
|
||||
@@ -3434,18 +3395,8 @@ static int __devinit t43x_init_one(struct pci_dev *pdev,
|
||||
mutex_init(&wc->lock);
|
||||
timer_setup(&wc->timer, t43x_timer, 0);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&wc->timer_work, timer_work_func, wc);
|
||||
#else
|
||||
INIT_WORK(&wc->timer_work, timer_work_func);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&wc->clksrc_work.work, t43x_clksrc_work_fn,
|
||||
&wc->clksrc_work.work);
|
||||
#else
|
||||
INIT_DELAYED_WORK(&wc->clksrc_work.work, t43x_clksrc_work_fn);
|
||||
#endif
|
||||
spin_lock_init(&wc->clksrc_work.lock);
|
||||
|
||||
wc->ddev = dahdi_create_device();
|
||||
@@ -3601,16 +3552,7 @@ static void __devexit t43x_remove_one(struct pci_dev *pdev)
|
||||
release_vpm450m(wc->vpm);
|
||||
wc->vpm = NULL;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
# ifdef T43X_HAVE_CANCEL_WORK_SYNC
|
||||
cancel_work_sync(&wc->clksrc_work.work);
|
||||
# else
|
||||
cancel_delayed_work(&wc->clksrc_work.work);
|
||||
flush_workqueue(wc->wq);
|
||||
# endif
|
||||
#else
|
||||
cancel_delayed_work_sync(&wc->clksrc_work.work);
|
||||
#endif
|
||||
|
||||
del_timer_sync(&wc->timer);
|
||||
flush_workqueue(wc->wq);
|
||||
@@ -3670,7 +3612,7 @@ static int __init t43x_init(void)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
res = dahdi_pci_module(&t43x_driver);
|
||||
res = pci_register_driver(&t43x_driver);
|
||||
if (res)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -31,10 +31,8 @@
|
||||
#include <linux/version.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26)
|
||||
#define HAVE_RATELIMIT
|
||||
#include <linux/ratelimit.h>
|
||||
#endif
|
||||
|
||||
#include <dahdi/kernel.h>
|
||||
|
||||
@@ -129,11 +127,7 @@ static inline bool wcxb_is_pcie(const struct wcxb *xb)
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 33)
|
||||
return pci_is_pcie(xb->pdev);
|
||||
#else
|
||||
#ifndef WCXB_PCI_DEV_DOES_NOT_HAVE_IS_PCIE
|
||||
return (xb->pdev->is_pcie > 0);
|
||||
#else
|
||||
return (xb->flags.is_pcie > 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -484,7 +478,7 @@ static irqreturn_t _wcxb_isr(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
DAHDI_IRQ_HANDLER(wcxb_isr)
|
||||
static irqreturn_t wcxb_isr(int irq, void *dev_id)
|
||||
{
|
||||
irqreturn_t ret;
|
||||
unsigned long flags;
|
||||
@@ -653,10 +647,6 @@ int wcxb_init(struct wcxb *xb, const char *board_name, u32 int_mode)
|
||||
|
||||
pci_set_master(pdev);
|
||||
|
||||
#ifdef WCXB_PCI_DEV_DOES_NOT_HAVE_IS_PCIE
|
||||
xb->flags.is_pcie = pci_find_capability(pdev, PCI_CAP_ID_EXP) ? 1 : 0;
|
||||
#endif
|
||||
|
||||
WARN_ON(!pdev);
|
||||
if (!pdev)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -27,14 +27,6 @@
|
||||
#define WCXB_DEFAULT_MAXLATENCY 12U
|
||||
#define WCXB_DMA_CHAN_SIZE 128
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
/* The is_pcie member was backported but I'm not sure in which version. */
|
||||
# ifndef RHEL_RELEASE_VERSION
|
||||
#define WCXB_PCI_DEV_DOES_NOT_HAVE_IS_PCIE
|
||||
# endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
struct wcxb;
|
||||
|
||||
struct wcxb_operations {
|
||||
@@ -63,9 +55,6 @@ struct wcxb {
|
||||
u32 have_msi:1;
|
||||
u32 latency_locked:1;
|
||||
u32 drive_timing_cable:1;
|
||||
#ifdef WCXB_PCI_DEV_DOES_NOT_HAVE_IS_PCIE
|
||||
u32 is_pcie:1;
|
||||
#endif
|
||||
u32 dma_ins:1;
|
||||
} flags;
|
||||
void __iomem *membase;
|
||||
|
||||
@@ -57,8 +57,8 @@ xpp_verified = $(foreach file, $(xpp_verifications), $(file).verified)
|
||||
FXO_MODES = $(src)/../fxo_modes.h
|
||||
FXO_VERIFY = $(obj)/init_card_2_$(XPP_PROTOCOL_VERSION) -v $(obj)/init_fxo_modes
|
||||
|
||||
hostprogs-y := print_fxo_modes
|
||||
always := $(xpp_verified)
|
||||
hostprogs := print_fxo_modes
|
||||
always-y := $(xpp_verified)
|
||||
print_fxo_modes-objs := print_fxo_modes.o
|
||||
HOSTCFLAGS_print_fxo_modes.o += -include $(FXO_MODES)
|
||||
|
||||
|
||||
@@ -153,8 +153,12 @@ static int write_state_register(xpd_t *xpd, __u8 value);
|
||||
static bool bri_packet_is_valid(xpacket_t *pack);
|
||||
static void bri_packet_dump(const char *msg, xpacket_t *pack);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_bri_info_ops;
|
||||
#else
|
||||
static const struct file_operations proc_bri_info_ops;
|
||||
#endif
|
||||
#endif
|
||||
static int bri_spanconfig(struct file *file, struct dahdi_span *span,
|
||||
struct dahdi_lineconfig *lc);
|
||||
static int bri_chanconfig(struct file *file, struct dahdi_chan *chan,
|
||||
@@ -1740,13 +1744,22 @@ static int proc_bri_info_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, proc_bri_info_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations proc_bri_info_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_bri_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_bri_info_ops = {
|
||||
.proc_open = proc_bri_info_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations proc_bri_info_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_bri_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
#endif
|
||||
|
||||
static int bri_xpd_probe(struct device *dev)
|
||||
|
||||
@@ -107,9 +107,13 @@ enum fxo_leds {
|
||||
static bool fxo_packet_is_valid(xpacket_t *pack);
|
||||
static void fxo_packet_dump(const char *msg, xpacket_t *pack);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_fxo_info_ops;
|
||||
#else
|
||||
static const struct file_operations proc_fxo_info_ops;
|
||||
#endif
|
||||
#ifdef WITH_METERING
|
||||
static const struct file_operations proc_xpd_metering_ops;
|
||||
static const struct proc_ops proc_xpd_metering_ops;
|
||||
#endif
|
||||
#endif
|
||||
static void dahdi_report_battery(xpd_t *xpd, lineno_t chan);
|
||||
@@ -1484,13 +1488,22 @@ static int proc_fxo_info_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, proc_fxo_info_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations proc_fxo_info_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_fxo_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_fxo_info_ops = {
|
||||
.proc_open = proc_fxo_info_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations proc_fxo_info_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_fxo_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WITH_METERING
|
||||
static int proc_xpd_metering_show(struct seq_file *sfile, void *not_used)
|
||||
|
||||
@@ -160,11 +160,19 @@ enum neon_state {
|
||||
static bool fxs_packet_is_valid(xpacket_t *pack);
|
||||
static void fxs_packet_dump(const char *msg, xpacket_t *pack);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_fxs_info_ops;
|
||||
#else
|
||||
static const struct file_operations proc_fxs_info_ops;
|
||||
#endif
|
||||
#ifdef WITH_METERING
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_xpd_metering_ops;
|
||||
#else
|
||||
static const struct file_operations proc_xpd_metering_ops;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos);
|
||||
|
||||
#define PROC_FXS_INFO_FNAME "fxs_info"
|
||||
@@ -188,7 +196,7 @@ struct FXS_priv_data {
|
||||
xpp_line_t neon_blinking;
|
||||
xpp_line_t neonstate;
|
||||
xpp_line_t vbat_h; /* High voltage */
|
||||
struct timeval prev_key_time[CHANNELS_PERXPD];
|
||||
ktime_t prev_key_time[CHANNELS_PERXPD];
|
||||
int led_counter[NUM_LEDS][CHANNELS_PERXPD];
|
||||
int overheat_reset_counter[CHANNELS_PERXPD];
|
||||
int ohttimer[CHANNELS_PERXPD];
|
||||
@@ -1681,8 +1689,7 @@ static void process_hookstate(xpd_t *xpd, xpp_line_t offhook,
|
||||
* Reset our previous DTMF memories...
|
||||
*/
|
||||
BIT_CLR(priv->prev_key_down, i);
|
||||
priv->prev_key_time[i].tv_sec =
|
||||
priv->prev_key_time[i].tv_usec = 0L;
|
||||
priv->prev_key_time[i] = ktime_set(0L, 0UL);
|
||||
if (IS_SET(offhook, i)) {
|
||||
LINE_DBG(SIGNAL, xpd, i, "OFFHOOK\n");
|
||||
MARK_ON(priv, i, LED_GREEN);
|
||||
@@ -1795,8 +1802,9 @@ static void process_dtmf(xpd_t *xpd, uint portnum, __u8 val)
|
||||
bool want_mute;
|
||||
bool want_event;
|
||||
struct FXS_priv_data *priv;
|
||||
struct timeval now;
|
||||
int msec = 0;
|
||||
ktime_t now;
|
||||
s64 msec = 0;
|
||||
struct timespec64 ts;
|
||||
|
||||
if (!dtmf_detection)
|
||||
return;
|
||||
@@ -1813,16 +1821,16 @@ static void process_dtmf(xpd_t *xpd, uint portnum, __u8 val)
|
||||
BIT_SET(priv->prev_key_down, portnum);
|
||||
else
|
||||
BIT_CLR(priv->prev_key_down, portnum);
|
||||
do_gettimeofday(&now);
|
||||
if (priv->prev_key_time[portnum].tv_sec != 0)
|
||||
msec = usec_diff(&now, &priv->prev_key_time[portnum]) / 1000;
|
||||
now = ktime_get();
|
||||
if (!dahdi_ktime_equal(priv->prev_key_time[portnum], ktime_set(0, 0)))
|
||||
msec = ktime_ms_delta(now, priv->prev_key_time[portnum]);
|
||||
priv->prev_key_time[portnum] = now;
|
||||
ts = ktime_to_timespec64(now);
|
||||
LINE_DBG(SIGNAL, xpd, portnum,
|
||||
"[%lu.%06lu] DTMF digit %-4s '%c' "
|
||||
"(val=%d, want_mute=%s want_event=%s, delta=%d msec)\n",
|
||||
now.tv_sec, now.tv_usec, (key_down) ? "DOWN" : "UP", digit,
|
||||
val, (want_mute) ? "yes" : "no", (want_event) ? "yes" : "no",
|
||||
msec);
|
||||
"[%lld.%06ld] DTMF digit %-4s '%c' (val=%d, want_mute=%s want_event=%s, delta=%lld msec)\n",
|
||||
(s64)ts.tv_sec, ts.tv_nsec * NSEC_PER_USEC,
|
||||
(key_down) ? "DOWN" : "UP", digit, val,
|
||||
(want_mute) ? "yes" : "no", (want_event) ? "yes" : "no", msec);
|
||||
/*
|
||||
* FIXME: we currently don't use the want_dtmf_mute until
|
||||
* we are sure about the logic in Asterisk native bridging.
|
||||
@@ -2115,13 +2123,22 @@ static int proc_fxs_info_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, proc_fxs_info_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations proc_fxs_info_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_fxs_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_fxs_info_ops = {
|
||||
.proc_open = proc_fxs_info_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations proc_fxs_info_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_fxs_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WITH_METERING
|
||||
static ssize_t proc_xpd_metering_write(struct file *file,
|
||||
@@ -2165,12 +2182,20 @@ static int proc_xpd_metering_open(struct inode *inode, struct file *file)
|
||||
file->private_data = PDE_DATA(inode);
|
||||
}
|
||||
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_xpd_metering_ops = {
|
||||
.proc_open = proc_xpd_metering_open,
|
||||
.proc_write = proc_xpd_metering_write,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations proc_xpd_metering_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_xpd_metering_open,
|
||||
.write = proc_xpd_metering_write,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -561,9 +561,6 @@ static int __init xpp_mmap_init(void)
|
||||
xframe_cache =
|
||||
kmem_cache_create("xframe_cache",
|
||||
sizeof(xframe_t) + XFRAME_DATASIZE, 0, 0,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
|
||||
NULL,
|
||||
#endif
|
||||
NULL);
|
||||
if (!xframe_cache) {
|
||||
ret = -ENOMEM;
|
||||
|
||||
@@ -50,8 +50,15 @@ static const char rcsid[] = "$Id$";
|
||||
#ifdef PROTOCOL_DEBUG
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#define PROC_XBUS_COMMAND "command"
|
||||
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_xbus_command_ops;
|
||||
#else
|
||||
static const struct file_operations proc_xbus_command_ops;
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Command line parameters */
|
||||
@@ -65,8 +72,15 @@ static DEF_PARM_BOOL(dahdi_autoreg, 0, 0444,
|
||||
"Register devices automatically (1) or not (0). UNUSED.");
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xbus_read_proc_ops;
|
||||
#else
|
||||
static const struct file_operations xbus_read_proc_ops;
|
||||
#endif
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
static void transport_init(xbus_t *xbus, struct xbus_ops *ops,
|
||||
ushort max_send_size,
|
||||
struct device *transport_device, void *priv);
|
||||
@@ -259,7 +273,7 @@ void xframe_init(xbus_t *xbus, xframe_t *xframe, void *buf, size_t maxsize,
|
||||
xframe->packets = xframe->first_free = buf;
|
||||
xframe->frame_maxlen = maxsize;
|
||||
atomic_set(&xframe->frame_len, 0);
|
||||
do_gettimeofday(&xframe->tv_created);
|
||||
xframe->kt_created = ktime_get();
|
||||
xframe->xframe_magic = XFRAME_MAGIC;
|
||||
}
|
||||
EXPORT_SYMBOL(xframe_init);
|
||||
@@ -946,12 +960,12 @@ static int xbus_initialize(xbus_t *xbus)
|
||||
int unit;
|
||||
int subunit;
|
||||
xpd_t *xpd;
|
||||
struct timeval time_start;
|
||||
struct timeval time_end;
|
||||
ktime_t time_start;
|
||||
ktime_t time_end;
|
||||
unsigned long timediff;
|
||||
int res = 0;
|
||||
|
||||
do_gettimeofday(&time_start);
|
||||
time_start = ktime_get();
|
||||
XBUS_DBG(DEVICES, xbus, "refcount_xbus=%d\n", refcount_xbus(xbus));
|
||||
if (xbus_aquire_xpds(xbus) < 0) /* Until end of initialization */
|
||||
return -EBUSY;
|
||||
@@ -989,7 +1003,7 @@ static int xbus_initialize(xbus_t *xbus)
|
||||
}
|
||||
}
|
||||
xbus_echocancel(xbus, 1);
|
||||
do_gettimeofday(&time_end);
|
||||
time_end = ktime_get();
|
||||
timediff = usec_diff(&time_end, &time_start);
|
||||
timediff /= 1000 * 100;
|
||||
XBUS_INFO(xbus, "Initialized in %ld.%1ld sec\n", timediff / 10,
|
||||
@@ -1152,16 +1166,10 @@ err:
|
||||
* it returns only when all XPD's on the bus are detected and
|
||||
* initialized.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
|
||||
static void xbus_populate(struct work_struct *work)
|
||||
{
|
||||
struct xbus_workqueue *worker =
|
||||
container_of(work, struct xbus_workqueue, xpds_init_work);
|
||||
#else
|
||||
void xbus_populate(void *data)
|
||||
{
|
||||
struct xbus_workqueue *worker = data;
|
||||
#endif
|
||||
xbus_t *xbus;
|
||||
struct list_head *card;
|
||||
struct list_head *next_card;
|
||||
@@ -1238,11 +1246,7 @@ int xbus_process_worker(xbus_t *xbus)
|
||||
}
|
||||
XBUS_DBG(DEVICES, xbus, "\n");
|
||||
/* Initialize the work. (adapt to kernel API changes). */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&worker->xpds_init_work, xbus_populate);
|
||||
#else
|
||||
INIT_WORK(&worker->xpds_init_work, xbus_populate, worker);
|
||||
#endif
|
||||
BUG_ON(!xbus);
|
||||
/* Now send it */
|
||||
if (!queue_work(worker->wq, &worker->xpds_init_work)) {
|
||||
@@ -1765,8 +1769,7 @@ out:
|
||||
static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q)
|
||||
{
|
||||
seq_printf(sfile,
|
||||
"%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d "
|
||||
"worst_lag %02ld.%ld ms\n",
|
||||
"%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
|
||||
q->name, q->steady_state_count, q->count, q->max_count,
|
||||
q->worst_count, q->overflows, q->worst_lag_usec / 1000,
|
||||
q->worst_lag_usec % 1000);
|
||||
@@ -1802,8 +1805,9 @@ static int xbus_proc_show(struct seq_file *sfile, void *data)
|
||||
seq_printf(sfile, "%5d ", xbus->cpu_rcv_tasklet[i]);
|
||||
seq_printf(sfile, "\n");
|
||||
}
|
||||
seq_printf(sfile, "self_ticking: %d (last_tick at %ld)\n",
|
||||
xbus->self_ticking, xbus->ticker.last_sample.tv.tv_sec);
|
||||
seq_printf(sfile, "self_ticking: %d (last_tick at %lld)\n",
|
||||
xbus->self_ticking, ktime_divns(xbus->ticker.last_sample,
|
||||
NSEC_PER_SEC));
|
||||
seq_printf(sfile, "command_tick: %d\n",
|
||||
xbus->command_tick_counter);
|
||||
seq_printf(sfile, "usec_nosend: %d\n", xbus->usec_nosend);
|
||||
@@ -1838,13 +1842,22 @@ static int xbus_read_proc_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, xbus_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations xbus_read_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xbus_read_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xbus_read_proc_ops = {
|
||||
.proc_open = xbus_read_proc_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations xbus_read_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xbus_read_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
|
||||
#ifdef PROTOCOL_DEBUG
|
||||
static ssize_t proc_xbus_command_write(struct file *file,
|
||||
@@ -1937,11 +1950,19 @@ static int proc_xbus_command_open(struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops proc_xbus_command_ops = {
|
||||
.proc_open = proc_xbus_command_open,
|
||||
.proc_write = proc_xbus_command_write,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations proc_xbus_command_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_xbus_command_open,
|
||||
.write = proc_xbus_command_write,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
|
||||
#endif
|
||||
|
||||
static int xpp_proc_read_show(struct seq_file *sfile, void *data)
|
||||
@@ -1971,13 +1992,22 @@ static int xpp_proc_read_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, xpp_proc_read_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations xpp_proc_read_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xpp_proc_read_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xpp_proc_read_ops = {
|
||||
.proc_open = xpp_proc_read_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations xpp_proc_read_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xpp_proc_read_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif /* DAHDI_HAVE_PROC_OPS */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -234,8 +234,8 @@ struct xbus {
|
||||
spinlock_t lock;
|
||||
|
||||
/* PCM metrics */
|
||||
struct timeval last_tx_sync;
|
||||
struct timeval last_rx_sync;
|
||||
ktime_t last_tx_sync;
|
||||
ktime_t last_rx_sync;
|
||||
unsigned long max_tx_sync;
|
||||
unsigned long min_tx_sync;
|
||||
unsigned long max_rx_sync;
|
||||
@@ -255,7 +255,7 @@ struct xbus {
|
||||
*/
|
||||
int sync_adjustment;
|
||||
int sync_adjustment_offset;
|
||||
long pll_updated_at;
|
||||
ktime_t pll_updated_at;
|
||||
|
||||
atomic_t num_xpds;
|
||||
|
||||
@@ -279,10 +279,10 @@ struct xframe {
|
||||
struct list_head frame_list;
|
||||
atomic_t frame_len;
|
||||
xbus_t *xbus;
|
||||
struct timeval tv_created;
|
||||
struct timeval tv_queued;
|
||||
struct timeval tv_submitted;
|
||||
struct timeval tv_received;
|
||||
ktime_t kt_created;
|
||||
ktime_t kt_queued;
|
||||
ktime_t kt_submitted;
|
||||
ktime_t kt_received;
|
||||
/* filled by transport layer */
|
||||
size_t frame_maxlen;
|
||||
__u8 *packets; /* max XFRAME_DATASIZE */
|
||||
@@ -358,4 +358,9 @@ void xbus_sysfs_remove(xbus_t *xbus);
|
||||
|
||||
void astribank_uevent_send(xbus_t *xbus, enum kobject_action act);
|
||||
|
||||
static inline s64 xpp_ktime_sec_delta(ktime_t later, ktime_t earlier)
|
||||
{
|
||||
return ktime_divns(ktime_sub(later, earlier), NSEC_PER_SEC);
|
||||
}
|
||||
|
||||
#endif /* XBUS_CORE_H */
|
||||
|
||||
@@ -111,24 +111,23 @@ static void xpp_ticker_init(struct xpp_ticker *ticker)
|
||||
{
|
||||
memset(ticker, 0, sizeof(*ticker));
|
||||
spin_lock_init(&ticker->lock);
|
||||
do_gettimeofday(&ticker->last_sample.tv);
|
||||
ticker->last_sample = ktime_get();
|
||||
ticker->first_sample = ticker->last_sample;
|
||||
ticker_set_cycle(ticker, SYNC_ADJ_QUICK);
|
||||
}
|
||||
|
||||
static int xpp_ticker_step(struct xpp_ticker *ticker, const struct timeval *t)
|
||||
static int xpp_ticker_step(struct xpp_ticker *ticker, const ktime_t t)
|
||||
{
|
||||
unsigned long flags;
|
||||
long usec;
|
||||
s64 usec;
|
||||
bool cycled = 0;
|
||||
|
||||
spin_lock_irqsave(&ticker->lock, flags);
|
||||
ticker->last_sample.tv = *t;
|
||||
ticker->last_sample = t;
|
||||
/* rate adjust */
|
||||
if ((ticker->count % ticker->cycle) == ticker->cycle - 1) {
|
||||
usec =
|
||||
(long)usec_diff(&ticker->last_sample.tv,
|
||||
&ticker->first_sample.tv);
|
||||
usec = ktime_us_delta(ticker->last_sample,
|
||||
ticker->first_sample);
|
||||
ticker->first_sample = ticker->last_sample;
|
||||
ticker->tick_period = usec / ticker->cycle;
|
||||
cycled = 1;
|
||||
@@ -147,7 +146,7 @@ static inline void xbus_drift_clear(xbus_t *xbus)
|
||||
{
|
||||
struct xpp_drift *di = &xbus->drift;
|
||||
|
||||
do_gettimeofday(&di->last_lost_tick.tv);
|
||||
di->last_lost_tick = ktime_get();
|
||||
ticker_set_cycle(&xbus->ticker, SYNC_ADJ_QUICK);
|
||||
di->max_speed = -SYNC_ADJ_MAX;
|
||||
di->min_speed = SYNC_ADJ_MAX;
|
||||
@@ -190,14 +189,14 @@ static void sample_tick(xbus_t *xbus, int sample)
|
||||
* including abrupt changes in sync -- to verify the stability of the
|
||||
* algorithm.
|
||||
*/
|
||||
static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv)
|
||||
static void xpp_drift_step(xbus_t *xbus, const ktime_t kt)
|
||||
{
|
||||
struct xpp_drift *di = &xbus->drift;
|
||||
struct xpp_ticker *ticker = &xbus->ticker;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&di->lock, flags);
|
||||
xpp_ticker_step(&xbus->ticker, tv);
|
||||
xpp_ticker_step(&xbus->ticker, kt);
|
||||
/*
|
||||
* Do we need to be synchronized and is there an established reference
|
||||
* ticker (another Astribank or another DAHDI device) already?
|
||||
@@ -206,7 +205,7 @@ static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv)
|
||||
&& xbus->sync_mode == SYNC_MODE_PLL) {
|
||||
int new_delta_tick = ticker->count - ref_ticker->count;
|
||||
int lost_ticks = new_delta_tick - di->delta_tick;
|
||||
long usec_delta;
|
||||
s64 usec_delta;
|
||||
|
||||
di->delta_tick = new_delta_tick;
|
||||
if (lost_ticks) {
|
||||
@@ -233,9 +232,8 @@ static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv)
|
||||
}
|
||||
} else {
|
||||
/* Sample a delta */
|
||||
usec_delta =
|
||||
(long)usec_diff(&ticker->last_sample.tv,
|
||||
&ref_ticker->last_sample.tv);
|
||||
usec_delta = ktime_us_delta(ticker->last_sample,
|
||||
ref_ticker->last_sample);
|
||||
sample_tick(xbus, usec_delta);
|
||||
if ((ticker->count % SYNC_CYCLE) >
|
||||
(SYNC_CYCLE - SYNC_CYCLE_SAMPLE))
|
||||
@@ -282,8 +280,7 @@ static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv)
|
||||
di->offset_min = offset;
|
||||
|
||||
XBUS_DBG(SYNC, xbus,
|
||||
"offset: %d, min_speed=%d, "
|
||||
"max_speed=%d, usec_delta(last)=%ld\n",
|
||||
"offset: %d, min_speed=%d, max_speed=%d, usec_delta(last)=%lld\n",
|
||||
offset_prev, di->min_speed,
|
||||
di->max_speed, usec_delta);
|
||||
XBUS_DBG(SYNC, xbus,
|
||||
@@ -356,10 +353,8 @@ static void xpp_set_syncer(xbus_t *xbus, bool on)
|
||||
static void xbus_command_timer(TIMER_DATA_TYPE timer)
|
||||
{
|
||||
xbus_t *xbus = from_timer(xbus, timer, command_timer);
|
||||
struct timeval now;
|
||||
|
||||
BUG_ON(!xbus);
|
||||
do_gettimeofday(&now);
|
||||
xbus_command_queue_tick(xbus);
|
||||
if (!xbus->self_ticking) /* Must be 1KHz rate */
|
||||
mod_timer(&xbus->command_timer, jiffies + 1);
|
||||
@@ -489,34 +484,34 @@ static void reset_sync_counters(void)
|
||||
|
||||
static void send_drift(xbus_t *xbus, int drift)
|
||||
{
|
||||
struct timeval now;
|
||||
const ktime_t now = ktime_get();
|
||||
const char *msg;
|
||||
s64 msec_delta;
|
||||
|
||||
BUG_ON(abs(drift) > SYNC_ADJ_MAX);
|
||||
do_gettimeofday(&now);
|
||||
if (drift > xbus->sync_adjustment)
|
||||
msg = "up";
|
||||
else
|
||||
msg = "down";
|
||||
msec_delta = ktime_ms_delta(now, xbus->pll_updated_at);
|
||||
XBUS_DBG(SYNC, xbus,
|
||||
"%sDRIFT adjust %s (%d) (last update %ld seconds ago)\n",
|
||||
"%sDRIFT adjust %s (%d) (last update %lld seconds ago)\n",
|
||||
(disable_pll_sync) ? "Fake " : "", msg, drift,
|
||||
now.tv_sec - xbus->pll_updated_at);
|
||||
msec_delta / MSEC_PER_SEC);
|
||||
if (!disable_pll_sync)
|
||||
CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_PLL,
|
||||
drift);
|
||||
xbus->pll_updated_at = now.tv_sec;
|
||||
xbus->pll_updated_at = now;
|
||||
}
|
||||
|
||||
static void global_tick(void)
|
||||
{
|
||||
struct timeval now;
|
||||
ktime_t now = ktime_get();
|
||||
|
||||
do_gettimeofday(&now);
|
||||
atomic_inc(&xpp_tick_counter);
|
||||
if ((atomic_read(&xpp_tick_counter) % BIG_TICK_INTERVAL) == 0)
|
||||
reset_sync_counters();
|
||||
xpp_ticker_step(&global_ticks_series, &now);
|
||||
xpp_ticker_step(&global_ticks_series, now);
|
||||
}
|
||||
|
||||
#ifdef DAHDI_SYNC_TICK
|
||||
@@ -525,11 +520,11 @@ void dahdi_sync_tick(struct dahdi_span *span, int is_master)
|
||||
struct phonedev *phonedev = container_of(span, struct phonedev, span);
|
||||
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
|
||||
static int redundant_ticks; /* for extra spans */
|
||||
struct timeval now;
|
||||
ktime_t now;
|
||||
|
||||
if (!force_dahdi_sync)
|
||||
goto noop;
|
||||
do_gettimeofday(&now);
|
||||
now = ktime_get();
|
||||
BUG_ON(!xpd);
|
||||
/*
|
||||
* Detect if any of our spans is dahdi sync master
|
||||
@@ -562,7 +557,7 @@ void dahdi_sync_tick(struct dahdi_span *span, int is_master)
|
||||
#endif
|
||||
goto noop;
|
||||
}
|
||||
xpp_ticker_step(&dahdi_ticker, &now);
|
||||
xpp_ticker_step(&dahdi_ticker, now);
|
||||
dahdi_tick_count++;
|
||||
//flip_parport_bit(1);
|
||||
noop:
|
||||
@@ -854,15 +849,14 @@ static bool pcm_valid(xpd_t *xpd, xpacket_t *pack)
|
||||
static inline void pcm_frame_out(xbus_t *xbus, xframe_t *xframe)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct timeval now;
|
||||
unsigned long usec;
|
||||
const ktime_t now = ktime_get();
|
||||
s64 usec;
|
||||
|
||||
spin_lock_irqsave(&xbus->lock, flags);
|
||||
do_gettimeofday(&now);
|
||||
if (unlikely(disable_pcm || !XBUS_IS(xbus, READY)))
|
||||
goto dropit;
|
||||
if (XPACKET_ADDR_SYNC((xpacket_t *)xframe->packets)) {
|
||||
usec = usec_diff(&now, &xbus->last_tx_sync);
|
||||
usec = ktime_us_delta(now, xbus->last_tx_sync);
|
||||
xbus->last_tx_sync = now;
|
||||
/* ignore startup statistics */
|
||||
if (likely
|
||||
@@ -872,8 +866,7 @@ static inline void pcm_frame_out(xbus_t *xbus, xframe_t *xframe)
|
||||
|
||||
if ((rate_limit++ % 5003) == 0)
|
||||
XBUS_DBG(SYNC, xbus,
|
||||
"Bad PCM TX timing(%d): "
|
||||
"usec=%ld.\n",
|
||||
"Bad PCM TX timing(%d): usec=%lld.\n",
|
||||
rate_limit, usec);
|
||||
}
|
||||
if (usec > xbus->max_tx_sync)
|
||||
@@ -1187,11 +1180,10 @@ static void xbus_tick(xbus_t *xbus)
|
||||
while ((xframe = xframe_dequeue(&xbus->pcm_tospan)) != NULL) {
|
||||
copy_pcm_tospan(xbus, xframe);
|
||||
if (XPACKET_ADDR_SYNC((xpacket_t *)xframe->packets)) {
|
||||
struct timeval now;
|
||||
unsigned long usec;
|
||||
ktime_t now = ktime_get();
|
||||
s64 usec;
|
||||
|
||||
do_gettimeofday(&now);
|
||||
usec = usec_diff(&now, &xbus->last_rx_sync);
|
||||
usec = ktime_us_delta(now, xbus->last_rx_sync);
|
||||
xbus->last_rx_sync = now;
|
||||
/* ignore startup statistics */
|
||||
if (likely
|
||||
@@ -1202,9 +1194,7 @@ static void xbus_tick(xbus_t *xbus)
|
||||
|
||||
if ((rate_limit++ % 5003) == 0)
|
||||
XBUS_DBG(SYNC, xbus,
|
||||
"Bad PCM RX "
|
||||
"timing(%d): "
|
||||
"usec=%ld.\n",
|
||||
"Bad PCM RX timing(%d): usec=%lld.\n",
|
||||
rate_limit, usec);
|
||||
}
|
||||
if (usec > xbus->max_rx_sync)
|
||||
@@ -1235,7 +1225,7 @@ static void xbus_tick(xbus_t *xbus)
|
||||
}
|
||||
}
|
||||
|
||||
static void do_tick(xbus_t *xbus, const struct timeval *tv_received)
|
||||
static void do_tick(xbus_t *xbus, const ktime_t kt_received)
|
||||
{
|
||||
int counter = atomic_read(&xpp_tick_counter);
|
||||
unsigned long flags;
|
||||
@@ -1244,7 +1234,7 @@ static void do_tick(xbus_t *xbus, const struct timeval *tv_received)
|
||||
if (global_ticker == xbus)
|
||||
global_tick(); /* called from here or dahdi_sync_tick() */
|
||||
spin_lock_irqsave(&ref_ticker_lock, flags);
|
||||
xpp_drift_step(xbus, tv_received);
|
||||
xpp_drift_step(xbus, kt_received);
|
||||
spin_unlock_irqrestore(&ref_ticker_lock, flags);
|
||||
if (likely(xbus->self_ticking))
|
||||
xbus_tick(xbus);
|
||||
@@ -1268,7 +1258,7 @@ void xframe_receive_pcm(xbus_t *xbus, xframe_t *xframe)
|
||||
* FIXME: what about PRI split?
|
||||
*/
|
||||
if (XPACKET_ADDR_SYNC((xpacket_t *)xframe->packets)) {
|
||||
do_tick(xbus, &xframe->tv_received);
|
||||
do_tick(xbus, xframe->kt_received);
|
||||
atomic_inc(&xbus->pcm_rx_counter);
|
||||
} else
|
||||
xbus->xbus_frag_count++;
|
||||
|
||||
@@ -39,16 +39,6 @@ enum sync_mode {
|
||||
SYNC_MODE_QUERY = 0x80,
|
||||
};
|
||||
|
||||
/*
|
||||
* Abstract representation of timestamp.
|
||||
* It would (eventually) replace the hard-coded
|
||||
* timeval structs so we can migrate to better
|
||||
* time representations.
|
||||
*/
|
||||
struct xpp_timestamp {
|
||||
struct timeval tv;
|
||||
};
|
||||
|
||||
/*
|
||||
* A ticker encapsulates the timing information of some
|
||||
* abstract tick source. The following tickers are used:
|
||||
@@ -60,8 +50,8 @@ struct xpp_timestamp {
|
||||
struct xpp_ticker { /* for rate calculation */
|
||||
int count;
|
||||
int cycle;
|
||||
struct xpp_timestamp first_sample;
|
||||
struct xpp_timestamp last_sample;
|
||||
ktime_t first_sample;
|
||||
ktime_t last_sample;
|
||||
int tick_period; /* usec/tick */
|
||||
spinlock_t lock;
|
||||
};
|
||||
@@ -75,7 +65,7 @@ struct xpp_drift {
|
||||
int lost_ticks; /* occurances */
|
||||
int lost_tick_count;
|
||||
int sync_inaccuracy;
|
||||
struct xpp_timestamp last_lost_tick;
|
||||
ktime_t last_lost_tick;
|
||||
long delta_sum;
|
||||
int offset_prev;
|
||||
int offset_range;
|
||||
@@ -88,15 +78,10 @@ struct xpp_drift {
|
||||
|
||||
void xpp_drift_init(xbus_t *xbus);
|
||||
|
||||
static inline long usec_diff(const struct timeval *tv1,
|
||||
const struct timeval *tv2)
|
||||
static inline long usec_diff(const ktime_t *tv1,
|
||||
const ktime_t *tv2)
|
||||
{
|
||||
long diff_sec;
|
||||
long diff_usec;
|
||||
|
||||
diff_sec = tv1->tv_sec - tv2->tv_sec;
|
||||
diff_usec = tv1->tv_usec - tv2->tv_usec;
|
||||
return diff_sec * 1000000 + diff_usec;
|
||||
return ktime_us_delta(*tv1, *tv2);
|
||||
}
|
||||
|
||||
int xbus_pcm_init(void *top);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/delay.h> /* for msleep() to debug */
|
||||
#include <linux/sched.h>
|
||||
#include <dahdi/kernel.h>
|
||||
#include "xpd.h"
|
||||
#include "xpp_dahdi.h"
|
||||
#include "xbus-core.h"
|
||||
@@ -117,24 +118,28 @@ static DEVICE_ATTR_READER(timing_show, dev, buf)
|
||||
xbus_t *xbus;
|
||||
struct xpp_drift *driftinfo;
|
||||
int len = 0;
|
||||
struct timeval now;
|
||||
ktime_t now;
|
||||
|
||||
do_gettimeofday(&now);
|
||||
now = ktime_get();
|
||||
xbus = dev_to_xbus(dev);
|
||||
driftinfo = &xbus->drift;
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len, "%-3s",
|
||||
sync_mode_name(xbus->sync_mode));
|
||||
if (xbus->sync_mode == SYNC_MODE_PLL) {
|
||||
bool pll_updated = !dahdi_ktime_equal(xbus->pll_updated_at,
|
||||
ktime_set(0, 0));
|
||||
s64 update_delta =
|
||||
(!pll_updated) ? 0 :
|
||||
xpp_ktime_sec_delta(now, xbus->pll_updated_at);
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len,
|
||||
" %5d: lost (%4d,%4d) : ", xbus->ticker.cycle,
|
||||
driftinfo->lost_ticks, driftinfo->lost_tick_count);
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len,
|
||||
"DRIFT %3d %ld sec ago", xbus->sync_adjustment,
|
||||
(xbus->pll_updated_at ==
|
||||
0) ? 0 : now.tv_sec - xbus->pll_updated_at);
|
||||
"DRIFT %3d %lld sec ago", xbus->sync_adjustment,
|
||||
update_delta);
|
||||
}
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, "\n");
|
||||
return len;
|
||||
@@ -229,7 +234,7 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
|
||||
xbus_t *xbus;
|
||||
struct xpp_drift *di;
|
||||
struct xpp_ticker *ticker;
|
||||
struct timeval now;
|
||||
ktime_t now = ktime_get();
|
||||
int len = 0;
|
||||
int hours;
|
||||
int minutes;
|
||||
@@ -244,8 +249,7 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
|
||||
/*
|
||||
* Calculate lost ticks time
|
||||
*/
|
||||
do_gettimeofday(&now);
|
||||
seconds = now.tv_sec - di->last_lost_tick.tv.tv_sec;
|
||||
seconds = ktime_ms_delta(now, di->last_lost_tick) / 1000;
|
||||
minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
hours = minutes / 60;
|
||||
@@ -407,34 +411,6 @@ static int astribank_match(struct device *dev, struct device_driver *driver)
|
||||
XBUS_ADD_UEVENT_VAR("XBUS_NAME=%s", xbus->busname); \
|
||||
} while (0)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
#define XBUS_ADD_UEVENT_VAR(fmt, val...) \
|
||||
do { \
|
||||
int err = add_uevent_var(envp, num_envp, &i, \
|
||||
buffer, buffer_size, &len, \
|
||||
fmt, val); \
|
||||
if (err) \
|
||||
return err; \
|
||||
} while (0)
|
||||
|
||||
static int astribank_uevent(struct device *dev, char **envp, int num_envp,
|
||||
char *buffer, int buffer_size)
|
||||
{
|
||||
xbus_t *xbus;
|
||||
int i = 0;
|
||||
int len = 0;
|
||||
extern char *initdir;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
xbus = dev_to_xbus(dev);
|
||||
DBG(GENERAL, "SYFS bus_id=%s xbus=%s\n", dev_name(dev), xbus->busname);
|
||||
XBUS_VAR_BLOCK;
|
||||
envp[i] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#define XBUS_ADD_UEVENT_VAR(fmt, val...) \
|
||||
do { \
|
||||
int err = add_uevent_var(kenv, fmt, val); \
|
||||
@@ -455,8 +431,6 @@ static int astribank_uevent(struct device *dev, struct kobj_uevent_env *kenv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void astribank_uevent_send(xbus_t *xbus, enum kobject_action act)
|
||||
{
|
||||
struct kobject *kobj;
|
||||
|
||||
@@ -103,11 +103,7 @@ typedef char *charp;
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* Kernel versions... */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
#define KMEM_CACHE_T kmem_cache_t
|
||||
#else
|
||||
#define KMEM_CACHE_T struct kmem_cache
|
||||
#endif
|
||||
|
||||
#define KZALLOC(size, gfp) my_kzalloc(size, gfp)
|
||||
#define KZFREE(p) \
|
||||
@@ -116,7 +112,6 @@ typedef char *charp;
|
||||
kfree(p); \
|
||||
} while (0);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
|
||||
#define DEVICE_ATTR_READER(name, dev, buf) \
|
||||
ssize_t name(struct device *dev, \
|
||||
struct device_attribute *attr, char *buf)
|
||||
@@ -124,12 +119,6 @@ typedef char *charp;
|
||||
ssize_t name(struct device *dev, \
|
||||
struct device_attribute *attr, \
|
||||
const char *buf, size_t count)
|
||||
#else
|
||||
#define DEVICE_ATTR_READER(name, dev, buf) \
|
||||
ssize_t name(struct device *dev, char *buf)
|
||||
#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
|
||||
ssize_t name(struct device *dev, const char *buf, size_t count)
|
||||
#endif
|
||||
#define DRIVER_ATTR_READER(name, drv, buf) \
|
||||
ssize_t name(struct device_driver *drv, char * buf)
|
||||
|
||||
@@ -142,19 +131,9 @@ typedef char *charp;
|
||||
#define SET_PROC_DIRENTRY_OWNER(p) do { } while (0);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
|
||||
/* Also don't define this for later RHEL >= 5.2. */
|
||||
#if defined(RHEL_RELEASE_CODE) && defined(RHEL_RELEASE_VERSION)
|
||||
#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5, 3)
|
||||
typedef int bool;
|
||||
#endif
|
||||
#else
|
||||
typedef int bool;
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
typedef int bool;
|
||||
#endif
|
||||
#endif /* ifdef __KERNEL__ */
|
||||
typedef struct xbus xbus_t;
|
||||
typedef struct xpd xpd_t;
|
||||
typedef struct xframe xframe_t;
|
||||
|
||||
@@ -34,15 +34,15 @@ static void __xframe_dump_queue(struct xframe_queue *q)
|
||||
xframe_t *xframe;
|
||||
int i = 0;
|
||||
char prefix[30];
|
||||
struct timeval now;
|
||||
ktime_t now = ktime_get();
|
||||
|
||||
do_gettimeofday(&now);
|
||||
printk(KERN_DEBUG "%s: dump queue '%s' (first packet in each frame)\n",
|
||||
THIS_MODULE->name, q->name);
|
||||
list_for_each_entry_reverse(xframe, &q->head, frame_list) {
|
||||
xpacket_t *pack = (xpacket_t *)&xframe->packets[0];
|
||||
long usec = usec_diff(&now, &xframe->tv_queued);
|
||||
snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5ld.%03ld msec",
|
||||
s64 usec = ktime_us_delta(now, xframe->kt_queued);
|
||||
|
||||
snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03lld msec",
|
||||
i++, usec / 1000, usec % 1000);
|
||||
dump_packet(prefix, pack, 1);
|
||||
}
|
||||
@@ -60,9 +60,7 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
|
||||
if (q->count >= q->max_count) {
|
||||
q->overflows++;
|
||||
if ((overflow_cnt++ % 1000) < 5) {
|
||||
NOTICE("Overflow of %-15s: counts %3d, %3d, %3d "
|
||||
"worst %3d, overflows %3d "
|
||||
"worst_lag %02ld.%ld ms\n",
|
||||
NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
|
||||
q->name, q->steady_state_count, q->count,
|
||||
q->max_count, q->worst_count, q->overflows,
|
||||
q->worst_lag_usec / 1000,
|
||||
@@ -75,7 +73,7 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
|
||||
if (++q->count > q->worst_count)
|
||||
q->worst_count = q->count;
|
||||
list_add_tail(&xframe->frame_list, &q->head);
|
||||
do_gettimeofday(&xframe->tv_queued);
|
||||
xframe->kt_queued = ktime_get();
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@@ -96,8 +94,8 @@ static xframe_t *__xframe_dequeue(struct xframe_queue *q)
|
||||
{
|
||||
xframe_t *frm = NULL;
|
||||
struct list_head *h;
|
||||
struct timeval now;
|
||||
unsigned long usec_lag;
|
||||
ktime_t now;
|
||||
s64 usec_lag;
|
||||
|
||||
if (list_empty(&q->head))
|
||||
goto out;
|
||||
@@ -105,12 +103,8 @@ static xframe_t *__xframe_dequeue(struct xframe_queue *q)
|
||||
list_del_init(h);
|
||||
--q->count;
|
||||
frm = list_entry(h, xframe_t, frame_list);
|
||||
do_gettimeofday(&now);
|
||||
usec_lag =
|
||||
(now.tv_sec - frm->tv_queued.tv_sec) * 1000 * 1000 + (now.tv_usec -
|
||||
frm->
|
||||
tv_queued.
|
||||
tv_usec);
|
||||
now = ktime_get();
|
||||
usec_lag = ktime_us_delta(now, frm->kt_queued);
|
||||
if (q->worst_lag_usec < usec_lag)
|
||||
q->worst_lag_usec = usec_lag;
|
||||
out:
|
||||
@@ -284,7 +278,7 @@ xframe_t *get_xframe(struct xframe_queue *q)
|
||||
BUG_ON(xframe->xframe_magic != XFRAME_MAGIC);
|
||||
atomic_set(&xframe->frame_len, 0);
|
||||
xframe->first_free = xframe->packets;
|
||||
do_gettimeofday(&xframe->tv_created);
|
||||
xframe->kt_created = ktime_get();
|
||||
/*
|
||||
* If later parts bother to correctly initialize their
|
||||
* headers, there is no need to memset() the whole data.
|
||||
|
||||
@@ -19,7 +19,7 @@ struct xframe_queue {
|
||||
/* statistics */
|
||||
unsigned int worst_count;
|
||||
unsigned int overflows;
|
||||
unsigned long worst_lag_usec; /* since xframe creation */
|
||||
s64 worst_lag_usec; /* since xframe creation */
|
||||
};
|
||||
|
||||
void xframe_queue_init(struct xframe_queue *q, unsigned int steady_state_count,
|
||||
|
||||
@@ -32,11 +32,7 @@
|
||||
#include <linux/version.h>
|
||||
#include <asm/atomic.h>
|
||||
#include <linux/slab.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
#include <linux/semaphore.h>
|
||||
#else
|
||||
#include <asm/semaphore.h>
|
||||
#endif
|
||||
#include <linux/moduleparam.h>
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
||||
@@ -103,8 +103,12 @@ int total_registered_spans(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xpd_read_proc_ops;
|
||||
#else
|
||||
static const struct file_operations xpd_read_proc_ops;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*------------------------- XPD Management -------------------------*/
|
||||
|
||||
@@ -392,13 +396,22 @@ static int xpd_read_proc_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, xpd_read_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations xpd_read_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xpd_read_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xpd_read_proc_ops = {
|
||||
.proc_open = xpd_read_proc_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations xpd_read_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xpd_read_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ struct xusb {
|
||||
int counters[XUSB_COUNTER_MAX];
|
||||
|
||||
/* metrics */
|
||||
struct timeval last_tx;
|
||||
ktime_t last_tx;
|
||||
unsigned int max_tx_delay;
|
||||
uint usb_tx_delay[NUM_BUCKETS];
|
||||
uint sluggish_debounce;
|
||||
@@ -222,26 +222,19 @@ static unsigned bus_count;
|
||||
/* prevent races between open() and disconnect() */
|
||||
static DEFINE_MUTEX(protect_xusb_devices);
|
||||
|
||||
/*
|
||||
* 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
|
||||
#endif
|
||||
|
||||
static void xpp_send_callback(USB_PASS_CB(urb));
|
||||
static void xpp_receive_callback(USB_PASS_CB(urb));
|
||||
static void xpp_send_callback(struct urb *urb);
|
||||
static void xpp_receive_callback(struct urb *urb);
|
||||
static int xusb_probe(struct usb_interface *interface,
|
||||
const struct usb_device_id *id);
|
||||
static void xusb_disconnect(struct usb_interface *interface);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xusb_read_proc_ops;
|
||||
#else
|
||||
static const struct file_operations xusb_read_proc_ops;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
@@ -377,7 +370,7 @@ static int do_send_xframe(xbus_t *xbus, xframe_t *xframe)
|
||||
BUG_ON(!urb);
|
||||
/* update urb length */
|
||||
urb->transfer_buffer_length = XFRAME_LEN(xframe);
|
||||
do_gettimeofday(&xframe->tv_submitted);
|
||||
xframe->kt_submitted = ktime_get();
|
||||
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (ret < 0) {
|
||||
static int rate_limit;
|
||||
@@ -869,14 +862,14 @@ static void xusb_disconnect(struct usb_interface *interface)
|
||||
mutex_unlock(&protect_xusb_devices);
|
||||
}
|
||||
|
||||
static void xpp_send_callback(USB_PASS_CB(urb))
|
||||
static void xpp_send_callback(struct urb *urb)
|
||||
{
|
||||
struct uframe *uframe = urb_to_uframe(urb);
|
||||
xframe_t *xframe = &uframe->xframe;
|
||||
xusb_t *xusb = uframe->xusb;
|
||||
xbus_t *xbus = xbus_num(xusb->xbus_num);
|
||||
struct timeval now;
|
||||
long usec;
|
||||
ktime_t now;
|
||||
s64 usec;
|
||||
int writes = atomic_read(&xusb->pending_writes);
|
||||
int i;
|
||||
|
||||
@@ -887,9 +880,9 @@ static void xpp_send_callback(USB_PASS_CB(urb))
|
||||
}
|
||||
//flip_parport_bit(6);
|
||||
atomic_dec(&xusb->pending_writes);
|
||||
do_gettimeofday(&now);
|
||||
xusb->last_tx = xframe->tv_submitted;
|
||||
usec = usec_diff(&now, &xframe->tv_submitted);
|
||||
now = ktime_get();
|
||||
xusb->last_tx = xframe->kt_submitted;
|
||||
usec = ktime_us_delta(now, xframe->kt_submitted);
|
||||
if (usec < 0)
|
||||
usec = 0; /* System clock jumped */
|
||||
if (usec > xusb->max_tx_delay)
|
||||
@@ -935,7 +928,7 @@ static void xpp_send_callback(USB_PASS_CB(urb))
|
||||
XUSB_ERR(xusb, "A urb from non-connected device?\n");
|
||||
}
|
||||
|
||||
static void xpp_receive_callback(USB_PASS_CB(urb))
|
||||
static void xpp_receive_callback(struct urb *urb)
|
||||
{
|
||||
struct uframe *uframe = urb_to_uframe(urb);
|
||||
xframe_t *xframe = &uframe->xframe;
|
||||
@@ -943,9 +936,8 @@ static void xpp_receive_callback(USB_PASS_CB(urb))
|
||||
xbus_t *xbus = xbus_num(xusb->xbus_num);
|
||||
size_t size;
|
||||
bool do_resubmit = 1;
|
||||
struct timeval now;
|
||||
ktime_t now = ktime_get();
|
||||
|
||||
do_gettimeofday(&now);
|
||||
atomic_dec(&xusb->pending_reads);
|
||||
if (!xbus) {
|
||||
XUSB_ERR(xusb,
|
||||
@@ -973,7 +965,7 @@ static void xpp_receive_callback(USB_PASS_CB(urb))
|
||||
goto err;
|
||||
}
|
||||
atomic_set(&xframe->frame_len, size);
|
||||
xframe->tv_received = now;
|
||||
xframe->kt_received = now;
|
||||
|
||||
// if (debug)
|
||||
// dump_xframe("USB_FRAME_RECEIVE", xbus, xframe, debug);
|
||||
@@ -1026,15 +1018,7 @@ static int __init xpp_usb_init(void)
|
||||
|
||||
xusb_cache =
|
||||
kmem_cache_create("xusb_cache", sizeof(xframe_t) + XFRAME_DATASIZE,
|
||||
#if (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 22)) && defined(CONFIG_SLUB)
|
||||
0, SLAB_STORE_USER,
|
||||
#else
|
||||
0, 0,
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
|
||||
NULL,
|
||||
#endif
|
||||
NULL);
|
||||
0, 0, NULL);
|
||||
if (!xusb_cache) {
|
||||
ret = -ENOMEM;
|
||||
goto failure;
|
||||
@@ -1129,13 +1113,22 @@ static int xusb_read_proc_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, xusb_read_proc_show, PDE_DATA(inode));
|
||||
}
|
||||
|
||||
static const struct file_operations xusb_read_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xusb_read_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
#ifdef DAHDI_HAVE_PROC_OPS
|
||||
static const struct proc_ops xusb_read_proc_ops = {
|
||||
.proc_open = xusb_read_proc_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#else
|
||||
static const struct file_operations xusb_read_proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = xusb_read_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -283,9 +283,8 @@ out:
|
||||
int xframe_receive(xbus_t *xbus, xframe_t *xframe)
|
||||
{
|
||||
int ret = 0;
|
||||
struct timeval now;
|
||||
struct timeval tv_received;
|
||||
int usec;
|
||||
ktime_t kt_received;
|
||||
s64 usec;
|
||||
|
||||
if (XFRAME_LEN(xframe) < RPACKET_HEADERSIZE) {
|
||||
static int rate_limit;
|
||||
@@ -301,7 +300,7 @@ int xframe_receive(xbus_t *xbus, xframe_t *xframe)
|
||||
XBUS_DBG(GENERAL, xbus, "Dropped xframe. Is shutting down.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
tv_received = xframe->tv_received;
|
||||
kt_received = xframe->kt_received;
|
||||
/*
|
||||
* We want to check that xframes do not mix PCM and other commands
|
||||
*/
|
||||
@@ -315,10 +314,7 @@ int xframe_receive(xbus_t *xbus, xframe_t *xframe)
|
||||
ret = xframe_receive_cmd(xbus, xframe);
|
||||
}
|
||||
/* Calculate total processing time */
|
||||
do_gettimeofday(&now);
|
||||
usec =
|
||||
(now.tv_sec - tv_received.tv_sec) * 1000000 + now.tv_usec -
|
||||
tv_received.tv_usec;
|
||||
usec = ktime_us_delta(ktime_get(), kt_received);
|
||||
if (usec > xbus->max_rx_process)
|
||||
xbus->max_rx_process = usec;
|
||||
return ret;
|
||||
|
||||
@@ -58,44 +58,11 @@
|
||||
|
||||
#include <linux/poll.h>
|
||||
|
||||
#define dahdi_pci_module pci_register_driver
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
|
||||
#define DAHDI_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id)
|
||||
#else
|
||||
#define DAHDI_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id, struct pt_regs *regs)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
#ifdef CONFIG_PCI
|
||||
#include <linux/pci-aspm.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
#define HAVE_NET_DEVICE_OPS
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
|
||||
# ifdef RHEL_RELEASE_VERSION
|
||||
# if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5, 6)
|
||||
#define dev_name(dev) ((dev)->bus_id)
|
||||
#define dev_set_name(dev, format, ...) \
|
||||
snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__)
|
||||
# else
|
||||
#define dev_set_name(dev, format, ...) \
|
||||
do { \
|
||||
kobject_set_name(&(dev)->kobj, format, ## __VA_ARGS__); \
|
||||
snprintf((dev)->bus_id, BUS_ID_SIZE, \
|
||||
kobject_name(&(dev)->kobj)); \
|
||||
} while (0)
|
||||
# endif
|
||||
# else
|
||||
#define dev_name(dev) ((dev)->bus_id)
|
||||
#define dev_set_name(dev, format, ...) \
|
||||
snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__)
|
||||
# endif
|
||||
#endif
|
||||
#define DAHDI_HAVE_PROC_OPS
|
||||
|
||||
/* __dev* were removed in 3.8. They still have effect in 2.6.18. */
|
||||
#ifndef __devinit
|
||||
@@ -938,7 +905,7 @@ struct dahdi_device {
|
||||
const char *devicetype;
|
||||
struct device dev;
|
||||
unsigned int irqmisses;
|
||||
struct timespec registration_time;
|
||||
ktime_t registration_time;
|
||||
};
|
||||
|
||||
struct dahdi_span {
|
||||
@@ -1404,6 +1371,10 @@ static inline short dahdi_txtone_nextsample(struct dahdi_chan *ss)
|
||||
/*! Maximum audio mask */
|
||||
#define DAHDI_FORMAT_AUDIO_MASK ((1 << 16) - 1)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
|
||||
|
||||
#undef DAHDI_HAVE_PROC_OPS
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
||||
|
||||
#ifndef TIMER_DATA_TYPE
|
||||
@@ -1412,6 +1383,15 @@ static inline short dahdi_txtone_nextsample(struct dahdi_chan *ss)
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
|
||||
|
||||
#ifdef RHEL_RELEASE_VERSION
|
||||
#if RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(7, 5)
|
||||
#define DAHDI_HAVE_TIMER_SETUP
|
||||
#undef TIMER_DATA_TYPE
|
||||
#define TIMER_DATA_TYPE struct timer_list *
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DAHDI_HAVE_TIMER_SETUP
|
||||
/**
|
||||
* timer_setup - Added in 4.13.0. We can make a direct translation to the
|
||||
* setup_timer interface since DAHDI does not pass any flags to any of the
|
||||
@@ -1431,8 +1411,38 @@ timer_setup(struct timer_list *timer,
|
||||
container_of((struct timer_list *)(callback_timer), \
|
||||
typeof(*var), timer_fieldname)
|
||||
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
#define refcount_read atomic_read
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
#define dahdi_ktime_equal ktime_equal
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||
|
||||
#ifdef RHEL_RELEASE_VERSION
|
||||
#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 8)
|
||||
#define DAHDI_HAVE_KTIME_MS_DELTA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DAHDI_HAVE_KTIME_MS_DELTA
|
||||
static inline s64 dahdi_ktime_to_ms(const ktime_t kt)
|
||||
{
|
||||
struct timeval tv = ktime_to_timeval(kt);
|
||||
|
||||
return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
|
||||
}
|
||||
|
||||
static inline s64 ktime_ms_delta(const ktime_t later, const ktime_t earlier)
|
||||
{
|
||||
return dahdi_ktime_to_ms(ktime_sub(later, earlier));
|
||||
}
|
||||
#else
|
||||
#undef DAHDI_HAVE_KTIME_MS_DELTA
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
|
||||
|
||||
/* DAHDI only was using the xxx_clear_bit variants. */
|
||||
@@ -1465,112 +1475,29 @@ static inline void *PDE_DATA(const struct inode *inode)
|
||||
#endif
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
|
||||
|
||||
#define KERN_CONT ""
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
|
||||
|
||||
# ifndef RHEL_RELEASE_VERSION
|
||||
/* I'm not sure which 5.x release this was backported into. */
|
||||
static inline int try_wait_for_completion(struct completion *x)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret = 1;
|
||||
|
||||
spin_lock_irqsave(&x->wait.lock, flags);
|
||||
if (!x->done)
|
||||
ret = 0;
|
||||
else
|
||||
x->done--;
|
||||
spin_unlock_irqrestore(&x->wait.lock, flags);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#include <linux/proc_fs.h>
|
||||
static inline struct proc_dir_entry *proc_create_data(const char *name,
|
||||
mode_t mode,
|
||||
struct proc_dir_entry *parent,
|
||||
const struct file_operations *proc_fops,
|
||||
void *data)
|
||||
{
|
||||
struct proc_dir_entry *pde = create_proc_entry(name, mode, parent);
|
||||
if (!pde)
|
||||
return NULL;
|
||||
pde->proc_fops = proc_fops;
|
||||
pde->data = data;
|
||||
return pde;
|
||||
}
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
#ifndef clamp
|
||||
#define clamp(x, low, high) min(max(low, x), high)
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
|
||||
|
||||
/* Some distributions backported fatal_signal_pending so we'll use a macro to
|
||||
* override the inline function definition. */
|
||||
#define fatal_signal_pending(p) \
|
||||
(signal_pending((p)) && sigismember(&(p)->pending.signal, SIGKILL))
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
#ifndef PCIE_LINK_STATE_L0S
|
||||
#define PCIE_LINK_STATE_L0S 1
|
||||
#define PCIE_LINK_STATE_L1 2
|
||||
#define PCIE_LINK_STATE_CLKPM 4
|
||||
#endif
|
||||
#define pci_disable_link_state dahdi_pci_disable_link_state
|
||||
void dahdi_pci_disable_link_state(struct pci_dev *pdev, int state);
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
|
||||
|
||||
#define list_first_entry(ptr, type, member) \
|
||||
list_entry((ptr)->next, type, member)
|
||||
|
||||
#define strncasecmp strnicmp
|
||||
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#include <linux/ctype.h>
|
||||
/* A define of 'clamp_val' happened to be added in the patch
|
||||
* linux-2.6-sata-prep-work-for-rhel5-3.patch kernel-2.6.spec that also
|
||||
* backported support for strcasecmp to some later RHEL/Centos kernels.
|
||||
* If you have an older kernel that breaks because strcasecmp is already
|
||||
* defined, somebody out-smarted us. In that case, replace the line below
|
||||
* with '#if 0' to get the code building, and file a bug report at
|
||||
* https://issues.asterisk.org/ .
|
||||
*/
|
||||
#ifndef clamp_val
|
||||
static inline int strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
do {
|
||||
c1 = tolower(*s1++);
|
||||
c2 = tolower(*s2++);
|
||||
} while (c1 == c2 && c1 != 0);
|
||||
return c1 - c2;
|
||||
}
|
||||
#endif /* clamp_val */
|
||||
|
||||
#endif /* 2.6.22 */
|
||||
#endif /* 2.6.25 */
|
||||
#endif /* 2.6.26 */
|
||||
#endif /* 2.6.27 */
|
||||
#endif /* 2.6.31 */
|
||||
#endif /* 3.10.0 */
|
||||
#endif /* 3.16.0 */
|
||||
#endif /* 4.0.0 */
|
||||
#endif /* 4.10.0 */
|
||||
#endif /* 4.11.0 */
|
||||
#endif /* 4.13.0 */
|
||||
#else /* >= 4.15.0 */
|
||||
#endif /* 4.15.0 */
|
||||
#endif /* 5.6 */
|
||||
|
||||
#ifndef TIMER_DATA_TYPE
|
||||
#define TIMER_DATA_TYPE struct timer_list *
|
||||
#endif
|
||||
|
||||
#endif /* 4.15.0 */
|
||||
#ifndef dahdi_ktime_equal
|
||||
static inline int dahdi_ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
|
||||
{
|
||||
return cmp1 == cmp2;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DEFINE_SPINLOCK
|
||||
#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
|
||||
|
||||
10
test/docker/centos6
Normal file
10
test/docker/centos6
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM centos:6
|
||||
|
||||
RUN yum update -y
|
||||
RUN yum install -y \
|
||||
gcc \
|
||||
git \
|
||||
make \
|
||||
wget
|
||||
RUN yum install -y kernel-devel
|
||||
CMD ["/source/test/test-build.sh"]
|
||||
10
test/docker/centos7
Normal file
10
test/docker/centos7
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM centos:7
|
||||
|
||||
RUN yum update -y
|
||||
RUN yum install -y \
|
||||
gcc \
|
||||
git \
|
||||
make \
|
||||
wget
|
||||
RUN yum install -y kernel-devel.x86_64 0:3.10.0-1062.12.1
|
||||
CMD ["/source/test/test-build.sh"]
|
||||
12
test/docker/debianstable
Normal file
12
test/docker/debianstable
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM debian:stable
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
git \
|
||||
linux-headers-amd64 \
|
||||
make \
|
||||
wget
|
||||
|
||||
CMD ["/source/test/test-build.sh"]
|
||||
12
test/docker/debiantesting
Normal file
12
test/docker/debiantesting
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM debian:testing
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
git \
|
||||
linux-headers-amd64 \
|
||||
make \
|
||||
wget
|
||||
|
||||
CMD ["/source/test/test-build.sh"]
|
||||
11
test/docker/fedorarawhide
Normal file
11
test/docker/fedorarawhide
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM fedora:rawhide
|
||||
|
||||
RUN dnf update -y && dnf install -y \
|
||||
diffutils \
|
||||
gcc \
|
||||
git \
|
||||
kmod \
|
||||
make \
|
||||
wget
|
||||
RUN dnf update -y && dnf install -y kernel-devel
|
||||
CMD ["/source/test/test-build.sh"]
|
||||
41
test/test-build.sh
Executable file
41
test/test-build.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
JOBS=$1
|
||||
fi
|
||||
|
||||
if command -v apt >/dev/null; then
|
||||
if [ ! -e /root/last-update ]; then
|
||||
date > /root/last-update
|
||||
fi
|
||||
if [ -z "$(find /root/last-update -mmin -60)" ]; then
|
||||
apt-get update && apt-get install -y linux-headers-amd64
|
||||
date > /root/last-update
|
||||
fi
|
||||
KERNELS=$(find /usr/src -maxdepth 1 -type d -name 'linux-headers-*' -not -name '*common*')
|
||||
else
|
||||
if command -v dnf > /dev/null ; then
|
||||
dnf update -y dnf kernel-devel
|
||||
else
|
||||
yum update -y kernel-devel
|
||||
fi
|
||||
KERNELS=$(find /usr/src/kernels -maxdepth 1 -type d -regextype sed -regex '.*[.]\(el\|fc\).*')
|
||||
fi
|
||||
|
||||
if [ "$KERNELS" = "" ]; then
|
||||
echo >&2 "Failed to find any kernels"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the source into the container so we can run builds in parallel
|
||||
rm -fr /root/code
|
||||
cp -fr /source /root/code
|
||||
cd /root/code
|
||||
|
||||
for KSRC in $KERNELS ; do
|
||||
echo "Building against $KSRC"
|
||||
export KSRC=$KSRC
|
||||
make -s clean
|
||||
make -s -j $(grep -c "^processor" /proc/cpuinfo)
|
||||
done
|
||||
Reference in New Issue
Block a user