Browse Source

wanpipe-7.0.9.tgz

master
Harald Welte 8 months ago
parent
commit
65ad0c2f6e
  1. 4
      .git_info
  2. 2
      .router_version
  3. 9
      ChangeLog
  4. 5
      Makefile
  5. 26
      Setup
  6. 2
      deb_control/wanpipe.deb
  7. 2
      patches/kdrivers/include/aft_core_private.h
  8. 1
      patches/kdrivers/include/wanpipe.h
  9. 7
      patches/kdrivers/include/wanpipe_api_hdr.h
  10. 61
      patches/kdrivers/include/wanpipe_kernel.h
  11. 4
      patches/kdrivers/include/wanpipe_version.h
  12. 1
      patches/kdrivers/include/wanpipe_wanrouter.h
  13. 10
      patches/kdrivers/include/zapcompat.h
  14. 178
      patches/kdrivers/src/net/aft_core.c
  15. 55
      patches/kdrivers/src/net/sdla_chdlc.c
  16. 4
      patches/kdrivers/src/wanrouter/af_wanpipe.c
  17. 4
      patches/kdrivers/src/wanrouter/af_wanpipe_datascope.c
  18. 11
      patches/kdrivers/src/wanrouter/wanmain.c
  19. 269
      patches/kdrivers/src/wanrouter/wanproc.c
  20. 11
      rpmspec/wanpipe-mod.rpmspec
  21. 11
      rpmspec/wanpipe-util.rpmspec
  22. 11
      rpmspec/wanpipe.rpmspec
  23. 2
      samples/wanrouter
  24. 4
      ssmg/sangoma_mgd.trunk/chan_woomera.trunk/chan_woomera.c
  25. 11
      wanpipe.spec

4
.git_info

@ -1,2 +1,2 @@
wanpipe_linux: git ver f340d42
wanpipe_common: git ver fb45280
wanpipe_linux: git ver 136eb03
wanpipe_common: git ver 45b890f

2
.router_version

@ -1 +1 @@
wanpipe-7.0.8
wanpipe-7.0.9

9
ChangeLog

@ -8,6 +8,15 @@ Copyright (c) 1995-2013 Sangoma Technologies Inc.
For more info visit: http://wiki.sangoma.com
------------------------------------------------------------------------------
* Mon Jan 7 2014 Nenad Corbic <ncorbic@sangoma.com> - 7.0.9
==================================================================
- Support for Dahdi 2.8
- Support for Centos 6.5
- Support for kernels up to 3.12
- Fixes A116 clocking for dahdi when link is down
- Updates to A116 for possible NMI interrupt erros on some motherboards.
* Wed Nov 14 2013 Nenad Corbic <ncorbic@sangoma.com> - 7.0.8
==================================================================

5
Makefile

@ -113,6 +113,8 @@ EXTRA_UTIL_FLAGS += $(PRODUCT_DEFINES)
DAHDI_CFLAGS=
#Check if zaptel exists
ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
ZAPDIR_PRIV=$(ZAPDIR)
@ -159,6 +161,9 @@ EXTRA_CFLAGS += -I$(KDIR)/include/linux -I$(ZAPDIR)
RM = @rm -rf
JUNK = *~ *.bak DEADJOE
#Check for PDE_DATA kernel feature
KERN_PROC_PDE_FEATURE=$(shell grep PDE_DATA $(KDIR)/include/linux/proc_fs.h -c)
EXTRA_CFLAGS+=-DKERN_PROC_PDE_FEATURE=$(KERN_PROC_PDE_FEATURE)
# First pass, kernel Makefile reads module objects
ifneq ($(KERNELRELEASE),)

26
Setup

@ -149,6 +149,19 @@ check_inode_struct ()
fi
}
check_kern_pde_feature ()
{
if [ -e $SOURCEDIR/include/linux/proc_fs.h ];then
eval "grep PDE_DATA $SOURCEDIR/include/linux/proc_fs.h >/dev/null 2>/dev/null"
if [ $? -eq 0 ]; then
PDE_FEATURE="-DKERN_PROC_PDE_FEATURE=1"
else
PDE_FEATURE="-DKERN_PROC_PDE_FEATURE=0"
fi
PROTOCOL_DEFINES="$PROTOCOL_DEFINES $PDE_FEATURE "
fi
}
# ----------------------------------------------------------------------------
@ -3557,8 +3570,11 @@ CFLAGS="$CC -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dli
check_inode_struct
check_kern_pde_feature
if [ "$BRI_MODULE_TEST" = "YES" ]; then
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DBUILD_MOD_TESTER"
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DBUILD_MOD_TESTER"
fi
if [ 1 -eq 1 ]; then
@ -4120,10 +4136,10 @@ WANPIPE_OBJS=
LIP_LINKED_PROTOCOLS=
TMP_CFLAGS="-I/$WANPIPE_INCLUDE_DIR -I/ -I$SOURCEDIR/include -I$SOURCEDIR/include/linux -I../include/common -I../include "
TMP_CFLAGS="-I/$WANPIPE_INCLUDE_DIR -I/ -I$SOURCEDIR/include -I$SOURCEDIR/include/linux -I../include/common -I../include "
if [ "$REGPARM_OPT" = ".regparm" ]; then
TMP_CFLAGS=$TMP_CFLAGS" -mregparm=3 "
fi
TMP_CFLAGS=$TMP_CFLAGS" -mregparm=3 "
fi
if [ $FR_PROT = "YES" ]; then
if [ -e $DRIVER_UPDATE_DIR/fr ]; then
@ -7338,7 +7354,7 @@ KERNEL_UNAME=`uname -r`
PKG_NAME=wanpipe
DISTR_NAME="WANPIPE"
PROD=wanrouter
PROD_VER=7.0.8
PROD_VER=7.0.9
PROD_HOME=`pwd`
META_CONF=$PROD_HOME/$PROD.rc
WAN_INTR_DIR=$PROD_HOME/interfaces

2
deb_control/wanpipe.deb

@ -1,5 +1,5 @@
Package: wanpipe
Version: 7.0.8-0
Version: 7.0.9-0
Section: networking
Priority: optional
Architecture: all

2
patches/kdrivers/include/aft_core_private.h

@ -504,6 +504,8 @@ typedef struct private_area
char transaction_history[AFT_TRANSACTION_HISTORY][512];
int th_idx;
#endif
unsigned char rbsbits;
}private_area_t;

1
patches/kdrivers/include/wanpipe.h

@ -669,6 +669,7 @@ typedef struct
unsigned char global_poll_irq;
unsigned int tdm_api_cfg;
unsigned int tdm_api_dchan_cfg;
wan_ticks_t rbs_timeout;
} sdla_xilinx_t;

7
patches/kdrivers/include/wanpipe_api_hdr.h

@ -207,6 +207,10 @@ typedef struct wp_api_hdr
u_int8_t channel;
u_int8_t direction;
}bitstrm;
struct {
u_int8_t channel;
u_int8_t status;
}aft_legacy_rbs;
struct {
u_int8_t repeat;
u_int8_t len;
@ -232,6 +236,9 @@ typedef struct wp_api_hdr
#define wp_api_hdr_time_stamp_sec time_stamp_sec
#define wp_api_hdr_time_stamp_use time_stamp_usec
#define wp_api_legacy_rbs_channel aft_legacy_rbs.channel
#define wp_api_legacy_rbs_status aft_legacy_rbs.status
#define wp_api_rx_hdr_crc rx_h.crc
#define wp_api_rx_hdr_error_map rx_h.crc
#define wp_api_rx_hdr_max_queue_length rx_h.max_rx_queue_length

61
patches/kdrivers/include/wanpipe_kernel.h

@ -145,9 +145,20 @@ typedef int (wan_get_info_t)(char *, char **, off_t, int);
#define IRQF_SHARED SA_SHIRQ
#endif
/*==========================================================================
KERNEL 2.6.
*==========================================================================*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
#define LINUX_3_0
/* Not sure exactly when they removed write_proc_t, but in 3.11.8 is not there anymore */
#if defined(KERN_PROC_PDE_FEATURE) && KERN_PROC_PDE_FEATURE > 0
typedef int (write_proc_t)(char *, char **, off_t, int, int);
#endif
#ifndef pci_dev_b
#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
#endif
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
/* KERNEL 2.6.X */
@ -234,9 +245,20 @@ typedef int (wan_get_info_t)(char *, char **, off_t, int);
#define dev_init_buffers(a)
#define WP_PDE(_a) PDE(_a)
#if defined(KERN_PROC_PDE_FEATURE) && KERN_PROC_PDE_FEATURE > 0
# define WP_PDE_DATA PDE_DATA
#else
#include <linux/proc_fs.h>
static inline void*WP_PDE_DATA(const struct inode *inode)
{
struct proc_dir_entry* pde=PDE(inode);
if (pde) {
return pde->data;
}
return NULL;
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
# define wp_rcu_read_lock(in_dev) rcu_read_lock()
@ -346,15 +368,20 @@ typedef int (wan_get_info_t)(char *, char **, off_t, int);
#define wan_test_and_set_bit(a,b) test_and_set_bit((a),(b))
#define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(b))
static inline struct proc_dir_entry *WP_PDE(const struct inode *inode)
static inline void *WP_PDE_DATA(const struct inode *inode)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21)
return (struct proc_dir_entry *)inode->u.generic_ip;
struct proc_dir_entry *entry = (struct proc_dir_entry *)inode->u.generic_ip;
#else
return (struct proc_dir_entry *)inode->i_private;
struct proc_dir_entry *entry = (struct proc_dir_entry *)inode->i_private;
#endif
if (entry) {
return entry->data;
}
return NULL;
}
#define wp_rcu_read_lock(in_dev) read_lock_bh(&in_dev->lock)
#define wp_rcu_read_unlock(in_dev) read_unlock_bh(&in_dev->lock)
#define wp_readb(ptr) readb((ptr))
@ -524,15 +551,21 @@ typedef int (wan_get_info_t)(char *, char **, off_t, int);
#define wan_test_and_set_bit(a,b) test_and_set_bit((a),(b))
#define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(b))
static inline struct proc_dir_entry *WP_PDE(const struct inode *inode)
static inline void *WP_PDE_DATA(const struct inode *inode)
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
return (struct proc_dir_entry *)inode->u.generic_ip;
struct proc_dir_entry *entry = (struct proc_dir_entry *)inode->u.generic_ip;
#else
return (struct proc_dir_entry *)inode->i_private;
#endif
struct proc_dir_entry *entry = (struct proc_dir_entry *)inode->i_private;
#endif
if (entry) {
return entry->data;
}
return NULL;
}
#else
/* KERNEL 2.0.X */
@ -543,10 +576,14 @@ typedef int (wan_get_info_t)(char *, char **, off_t, int);
static inline struct proc_dir_entry *WP_PDE(const struct inode *inode)
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
return (struct proc_dir_entry *)inode->i_private;
struct proc_dir_entry *entry = (struct proc_dir_entry *)inode->i_private;
#else
return (struct proc_dir_entry *)inode->u.generic_ip;
struct proc_dir_entry *entry = (struct proc_dir_entry *)inode->u.generic_ip;
#endif
if (entry) {
return entry->data;
}
return NULL;
}
#define test_and_set_bit set_bit

4
patches/kdrivers/include/wanpipe_version.h

@ -10,14 +10,14 @@
#define WANPIPE_COMPANY "Sangoma Technologies Inc"
/********** LINUX **********/
#define WANPIPE_VERSION "7.0.8"
#define WANPIPE_VERSION "7.0.9"
#define WANPIPE_SUB_VERSION "0"
#define WANPIPE_LITE_VERSION "1.1.1"
#if defined(__LINUX__)
#define WANPIPE_VERSION_MAJOR 7
#define WANPIPE_VERSION_MINOR 0
#define WANPIPE_VERSION_MINOR1 8
#define WANPIPE_VERSION_MINOR1 9
#define WANPIPE_VERSION_MINOR2 0
#endif

1
patches/kdrivers/include/wanpipe_wanrouter.h

@ -457,7 +457,6 @@ extern int wanrouter_proc_add_interface(wan_device_t*,struct proc_dir_entry**,
extern int wanrouter_proc_delete_interface(wan_device_t*, char*);
extern void *sdla_get_hw_probe(void);
extern int wanrouter_proc_usage_check(void);
extern int wan_run_wanrouter(char* hwdevname, char *devname, char *action);
extern int register_wanpipe_fw_protocol (struct wanpipe_fw_register_struct *wp_fw_reg);

10
patches/kdrivers/include/zapcompat.h

@ -32,8 +32,14 @@
# include <dahdi/user.h> // this will bring dahdi user stuff
#endif
#if defined(DAHDI_27)
#if defined(DAHDI_28)
#define DAHDI_27
#define DAHDI_26
#define DAHDI_25
#define DAHDI_24
#define DAHDI_23
#define DAHDI_22
#elif defined(DAHDI_27)
#define DAHDI_26
#define DAHDI_25
#define DAHDI_24

178
patches/kdrivers/src/net/aft_core.c

@ -287,6 +287,9 @@ static int wp_aft_fifo_per_port_isr(sdla_t *card);
static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr);
static void wp_aft_serial_status_isr(sdla_t *card, u32 status);
static void wp_aft_free_timer_status_isr(sdla_t *card, u32 free_run_intr_status);
static void aft_report_rbsbits(void* pcard, int channel, unsigned char status);
static void aft_poll_rbsbits(sdla_t *card);
static void front_end_interrupt(sdla_t *card, unsigned long reg, int lock);
static void enable_data_error_intr(sdla_t *card);
@ -971,6 +974,13 @@ int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf)
conf->fe_cfg.cfg.te_cfg.active_ch = -1;
}
/* Use FE Poll option by default for A116 and T116 boards.
On some machines the use of front end interrupt results in NMI or
PCI parity errors */
if (card->adptr_type == AFT_ADPTR_T116 || card->adptr_type == A116_ADPTR_16TE1) {
conf->fe_cfg.poll_mode = WANOPT_YES;
}
memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t));
if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID) {
sdla_ds_te1_iface_init(&card->fe, &card->wandev.fe_iface);
@ -1051,6 +1061,19 @@ int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf)
card->u.aft.num_of_time_slots=NUM_OF_E1_CHANNELS;
}
if (IS_E1_CARD(card) && WAN_TE1_SIG_MODE(&card->fe) == WAN_TE1_SIG_CCS){
if (card->u.aft.cfg.rbs) {
DEBUG_EVENT("%s: Warning: Cannot enable rbs on E1 CCS line. Please remove RBS=YES in %s.conf. Ignoring RBS option\n",
card->devname,card->devname);
card->u.aft.cfg.rbs=0;
}
}
if (card->u.aft.cfg.rbs) {
card->wandev.te_report_rbsbits = aft_report_rbsbits;
}
}else{
DEBUG_EVENT("%s: Invalid Front-End media type!! (Not T1/E1/J1)\n",
card->devname);
@ -1400,6 +1423,9 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf)
DEBUG_EVENT("%s: Rx CRC Bytes = %d\n",
card->devname,
card->u.aft.cfg.rx_crc_bytes);
DEBUG_EVENT("%s: RBS Signalling = %s\n",
card->devname,
card->u.aft.cfg.rbs?"On":"Off");
DEBUG_EVENT("%s: Memory: Card=%d Wandev=%d Card Union=%d\n",
card->devname,sizeof(sdla_t),sizeof(wan_device_t),sizeof(card->u));
@ -1448,7 +1474,8 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf)
}
if (card->adptr_type == A116_ADPTR_16TE1) {
wan_set_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status);
wan_set_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status);
wan_set_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status);
wan_set_bit(AFT_TDM_FREE_RUN_ISR,&card->u.aft.chip_cfg_status);
}
} else {
@ -6001,6 +6028,15 @@ int aft_bh_rx(private_area_t* chan, netskb_t *new_skb, u8 pkt_error, int len)
if (chan->common.usedby == API){
if (card->u.aft.cfg.rbs) {
if ((SYSTEM_TICKS - card->u.aft.rbs_timeout) > HZ/50) {
card->u.aft.rbs_timeout = SYSTEM_TICKS;
aft_core_taskq_trigger(card,AFT_FE_TDM_RBS);
}
}
if (chan->wp_api_op_mode) {
int err;
wp_api_hdr_t *rx_hdr=NULL;
@ -8592,7 +8628,13 @@ static void handle_front_end_state(void *card_id,int lock)
aft_core_taskq_trigger(card,AFT_FE_LED);
if (card->u.aft.cfg.rbs == 1){
card->u.aft.cfg.rbs++;
if (card->wandev.fe_iface.set_fe_sigctrl){
DEBUG_EVENT("%s: Enabling rbs for all channels !\n",card->devname);
card->wandev.fe_iface.set_fe_sigctrl(&card->fe, WAN_TE_SIG_INTR, ENABLE_ALL_CHANNELS, WAN_ENABLE);
}
}
}
}else{
@ -11394,6 +11436,10 @@ static void aft_port_task (void * card_ptr, int arg)
}
#endif
if (card->u.aft.cfg.rbs && !card->u.aft.global_tdm_irq) {
aft_poll_rbsbits(card);
}
card->hw_iface.hw_unlock(card->hw,&smp_flags);
}
@ -12792,4 +12838,132 @@ int wp_aft_w400_init (sdla_t* card, wandev_conf_t *conf)
return wan_aft_init(card,conf);
}
static int send_rbs_oob_msg (sdla_t *card, private_area_t *chan, int channel, unsigned char status)
{
#if defined(__LINUX__)
unsigned char *buf;
wp_api_hdr_t *api_rx_el;
struct sk_buff *skb;
int err=0, len=5;
if (chan->common.usedby != API){
return -ENODEV;
}
if (!chan->common.sk){
return -ENODEV;
}
skb=wan_skb_alloc(sizeof(wp_api_hdr_t)+len);
if (!skb){
return -ENOMEM;
}
api_rx_el=(wp_api_hdr_t *)wan_skb_put(skb,sizeof(wp_api_hdr_t));
memset(api_rx_el,0,sizeof(wp_api_hdr_t));
api_rx_el->wp_api_legacy_rbs_channel=channel;
api_rx_el->wp_api_legacy_rbs_status=status;
buf = wan_skb_put(skb,1);
if (!buf){
wan_skb_free(skb);
return -ENOMEM;
}
#if 0
This conversion is done in te1 sources.
if (status & BIT_SIGX_A) signal |= WAN_RBS_SIG_A;
if (status & BIT_SIGX_B) signal |= WAN_RBS_SIG_B;
if (status & BIT_SIGX_C) signal |= WAN_RBS_SIG_C;
if (status & BIT_SIGX_D) signal |= WAN_RBS_SIG_D;
#endif
buf[0]=status;
skb->pkt_type = WAN_PACKET_ERR;
skb->protocol=htons(PVC_PROT);
skb->dev=chan->common.dev;
DEBUG_TEST("%s: Sending OOB message len=%i\n",
chan->if_name, wan_skb_len(skb));
if (wan_api_rx(chan,skb)!=0){
err=-ENODEV;
wan_skb_free(skb);
}
return err;
#else
DEBUG_EVENT("%s: OOB messages not supported!\n",
chan->if_name);
return -EINVAL;
#endif
}
static void aft_poll_rbsbits(sdla_t *card)
{
int i;
for (i=0; i<card->u.aft.num_of_time_slots ;i++){
if (!wan_test_bit(i,&card->u.aft.time_slot_map)){
continue;
}
card->wandev.fe_iface.read_rbsbits(
&card->fe,
i+1,
WAN_TE_RBS_UPDATE|WAN_TE_RBS_REPORT);
}
}
static void aft_report_rbsbits(void* pcard, int channel, unsigned char status)
{
sdla_t *card=(sdla_t *)pcard;
int i;
if (!wan_test_bit(channel-1, &card->u.aft.time_slot_map)) {
return;
}
for (i=0; i<card->u.aft.num_of_time_slots;i++) {
private_area_t *chan;
if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){
continue;
}
chan=(private_area_t*)card->u.aft.dev_to_ch_map[i];
if (!chan){
continue;
}
if (!wan_test_bit(0,&chan->up)){
continue;
}
if (!wan_test_bit(channel-1, &chan->time_slot_map)){
continue;
}
if (chan->rbsbits == status) {
continue;
}
chan->rbsbits = status;
DEBUG_TEST("%s: Report FirstTs=%i Ch=%i Status=0x%X TSMAP=0x%X\n",
card->devname,chan->first_time_slot, channel,status,card->u.aft.time_slot_map);
send_rbs_oob_msg (card, chan, channel, status);
break;
}
return;
}
/****** End ****************************************************************/

55
patches/kdrivers/src/net/sdla_chdlc.c

@ -2416,7 +2416,7 @@ static void rx_intr (sdla_t* card)
len = rxbuf.frame_length;
#if 1
#if 0
//defined(LINUX_2_4) || defined(LINUX_2_1)
if (card->tty_opt){
@ -2446,6 +2446,7 @@ static void rx_intr (sdla_t* card)
chdlc_priv_area = wan_netif_priv(dev);
#if 0
if (chdlc_priv_area->common.usedby == ANNEXG){
if (rxbuf.error_flag){
@ -2461,10 +2462,23 @@ static void rx_intr (sdla_t* card)
}
len = rxbuf.frame_length - CRC_LENGTH;
}
/* Allocate socket buffer */
skb = dev_alloc_skb(len+2);
#endif
if (rxbuf.error_flag){
++card->wandev.stats.rx_dropped;
printk(KERN_INFO "Bad Rx Frame - error flag set\n");
goto rx_exit;
}
if (rxbuf.frame_length <= 2 || rxbuf.frame_length > 4103){
++card->wandev.stats.rx_dropped;
printk(KERN_INFO "Bad Rx Frame Len=%i\n",rxbuf.frame_length);
goto rx_exit;
}
/* Allocate socket buffer */
skb = wan_skb_alloc(len+2+512);
if (skb == NULL) {
printk(KERN_INFO "%s: no socket buffers available!\n",
card->devname);
@ -2472,19 +2486,31 @@ static void rx_intr (sdla_t* card)
goto rx_exit;
}
/* Align IP on 16 byte */
skb_reserve(skb,2);
/* Copy data to the socket buffer */
if((addr + len) > card->u.c.rx_top_off + 1) {
unsigned tmp = card->u.c.rx_top_off - addr + 1;
buf = skb_put(skb, tmp);
if (wan_skb_tailroom(skb) < tmp) {
printk(KERN_INFO "%s: Error: rx packet len (tmp)=%i > tailroom %i\n",
card->devname,tmp,skb_tailroom(skb));
wan_skb_free(skb);
goto rx_exit;
}
buf = wan_skb_put(skb, tmp);
card->hw_iface.peek(card->hw, addr, buf, tmp);
addr = card->u.c.rx_base_off;
len -= tmp;
}
buf = skb_put(skb, len);
if (wan_skb_tailroom(skb) < len) {
printk(KERN_INFO "%s: Error: rx packet len=%i > tailroom %i\n",
card->devname,len,skb_tailroom(skb));
wan_skb_free(skb);
goto rx_exit;
}
buf = wan_skb_put(skb, len);
card->hw_iface.peek(card->hw, addr, buf, len);
skb->protocol = htons(ETH_P_IP);
@ -2511,7 +2537,7 @@ static void rx_intr (sdla_t* card)
api_rx_hdr->wan_hdr_chdlc_time_usec=tv.tv_usec;
skb->protocol = htons(WP_PVC_PROT);
wan_skb_reset_mac_header(skb);
//wan_skb_reset_mac_header(skb);
skb->dev = dev;
skb->pkt_type = WAN_PACKET_DATA;
@ -5010,8 +5036,13 @@ static void wanpipe_tty_receive(sdla_t *card, unsigned addr, unsigned int len)
tty->flip.flag_buf_ptr++;
}
#endif
#if !defined(LINUX_3_0)
tty->low_latency=1;
tty_flip_buffer_push(tty);
#else
# warning "FIXME: Compilation error on 3.X kernels"
#endif
}else{
if (len > TTY_CHDLC_MAX_MTU){
@ -5216,7 +5247,11 @@ static int change_speed(sdla_t *card, struct tty_struct *tty,
unsigned cflag;
int dbits,sbits,parity,handshaking;
#if !defined(LINUX_3_0)
cflag = tty->termios->c_cflag;
#else
# warning "FIXME: Compilation error on 3.X kernels"
#endif
/* There is always one stop bit */
sbits=WANOPT_ONE;

4
patches/kdrivers/src/wanrouter/af_wanpipe.c

@ -1736,7 +1736,9 @@ int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void *data)
}
read_lock(&wanpipe_sklist_lock);
#ifdef LINUX_2_6
#if defined(LINUX_3_0)
sk_for_each(sk, &wanpipe_sklist) {
#elif defined(LINUX_2_6)
sk_for_each(sk, node, &wanpipe_sklist) {
#else
for (sk = wanpipe_sklist; sk; sk = sk->next) {

4
patches/kdrivers/src/wanrouter/af_wanpipe_datascope.c

@ -152,7 +152,11 @@ int wanpipe_bind_sk_to_parent(struct sock *sk, netdevice_t *dev, struct wan_sock
#ifdef LINUX_2_6
{
struct hlist_node *node;
#ifdef LINUX_3_0
sk_for_each(parent_sk, &wanpipe_parent_sklist) {
#else
sk_for_each(parent_sk, node, &wanpipe_parent_sklist) {
#endif
if (SK_PRIV((parent_sk))->dev == dev) {
break;
}

11
patches/kdrivers/src/wanrouter/wanmain.c

@ -529,7 +529,6 @@ unsigned short wanrouter_type_trans (struct sk_buff *skb, netdevice_t *dev)
WAN_IOCTL_RET_TYPE WANDEF_IOCTL_FUNC(wanrouter_ioctl, struct file *file, unsigned int cmd, unsigned long arg)
{
WAN_IOCTL_RET_TYPE err = 0;
struct proc_dir_entry *dent;
wan_device_t *wandev;
#ifdef HAVE_UNLOCKED_IOCTL
@ -542,19 +541,17 @@ WAN_IOCTL_RET_TYPE WANDEF_IOCTL_FUNC(wanrouter_ioctl, struct file *file, unsigne
return -EINVAL;
}
dent = WP_PDE(inode);
if ((dent == NULL) || (dent->data == NULL)){
wandev = WP_PDE_DATA(inode);
if (!wandev) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
DEBUG_EVENT("%s: Invalid dent\n",
DEBUG_EVENT("%s: Invalid inode data\n",
__FUNCTION__);
#else
DEBUG_EVENT("%s: Invalid dent %p\n",
DEBUG_EVENT("%s: Invalid inode data %p\n",
__FUNCTION__,inode->u.generic_ip);
#endif
return -EINVAL;
}
wandev = dent->data;
if (wandev->magic != ROUTER_MAGIC){
DEBUG_EVENT("%s: Invalid wandev Magic Number\n",
__FUNCTION__);

269
patches/kdrivers/src/wanrouter/wanproc.c

@ -260,12 +260,12 @@ static struct proc_dir_entry *map_dir;
static int config_open(struct inode *inode, struct file *file)
{
return single_open(file, config_get_info, WP_PDE(inode)->data);
return single_open(file, config_get_info, WP_PDE_DATA(inode));
}
static int status_open(struct inode *inode, struct file *file)
{
return single_open(file, status_get_info, WP_PDE(inode)->data);
return single_open(file, status_get_info, WP_PDE_DATA(inode));
}
static struct file_operations config_fops = {
@ -286,7 +286,7 @@ static struct file_operations status_fops = {
static int wandev_open(struct inode *inode, struct file *file)
{
return single_open(file, wandev_get_info, WP_PDE(inode)->data);
return single_open(file, wandev_get_info, WP_PDE_DATA(inode));
}
static struct file_operations wandev_fops = {
@ -300,7 +300,7 @@ static struct file_operations wandev_fops = {
static int wp_hwprobe_open(struct inode *inode, struct file *file)
{
return single_open(file, probe_get_info, WP_PDE(inode)->data);
return single_open(file, probe_get_info, WP_PDE_DATA(inode));
}
static struct file_operations wp_hwprobe_fops = {
@ -313,7 +313,7 @@ static struct file_operations wp_hwprobe_fops = {
static int wp_hwprobe_legacy_open(struct inode *inode, struct file *file)
{
return single_open(file, probe_get_info_legacy, WP_PDE(inode)->data);
return single_open(file, probe_get_info_legacy, WP_PDE_DATA(inode));
}
static struct file_operations wp_hwprobe_legacy_fops = {
@ -326,7 +326,7 @@ static struct file_operations wp_hwprobe_legacy_fops = {
static int wp_hwprobe_verbose_open(struct inode *inode, struct file *file)
{
return single_open(file, probe_get_info_verbose, WP_PDE(inode)->data);
return single_open(file, probe_get_info_verbose, WP_PDE_DATA(inode));
}
@ -341,7 +341,7 @@ static struct file_operations wp_hwprobe_verbose_fops = {
static int wp_hwprobe_dump_open(struct inode *inode, struct file *file)
{
return single_open(file, probe_get_info_dump, WP_PDE(inode)->data);
return single_open(file, probe_get_info_dump, WP_PDE_DATA(inode));
}
static struct file_operations wp_hwprobe_dump_fops = {
@ -354,7 +354,7 @@ static struct file_operations wp_hwprobe_dump_fops = {
static int wp_map_open(struct inode *inode, struct file *file)
{
return single_open(file, map_get_info, WP_PDE(inode)->data);
return single_open(file, map_get_info, WP_PDE_DATA(inode));
}
static struct file_operations wp_map_fops = {
@ -367,7 +367,7 @@ static struct file_operations wp_map_fops = {
static int wp_iface_open(struct inode *inode, struct file *file)
{
return single_open(file, interfaces_get_info, WP_PDE(inode)->data);
return single_open(file, interfaces_get_info, WP_PDE_DATA(inode));
}
static struct file_operations wp_iface_fops = {
@ -380,7 +380,7 @@ static struct file_operations wp_iface_fops = {
static int wandev_mapdir_open(struct inode *inode, struct file *file)
{
return single_open(file, wandev_mapdir_get_info, WP_PDE(inode)->data);
return single_open(file, wandev_mapdir_get_info, WP_PDE_DATA(inode));
}
static struct file_operations wandev_mapdir_fops = {
@ -393,7 +393,7 @@ static struct file_operations wandev_mapdir_fops = {
static int wp_get_dev_config_open(struct inode *inode, struct file *file)
{
return single_open(file, get_dev_config_info, WP_PDE(inode)->data);
return single_open(file, get_dev_config_info, WP_PDE_DATA(inode));
}
static struct file_operations wp_get_dev_config_fops = {
@ -406,7 +406,7 @@ static struct file_operations wp_get_dev_config_fops = {
static int wp_get_dev_status_open(struct inode *inode, struct file *file)
{
return single_open(file, get_dev_status_info, WP_PDE(inode)->data);
return single_open(file, get_dev_status_info, WP_PDE_DATA(inode));
}
static struct file_operations wp_get_dev_status_fops = {
@ -422,7 +422,7 @@ static struct file_operations wp_get_dev_status_fops = {
static int wp_prot_dev_config_open(struct inode *inode, struct file *file)
{
return 0;
//return single_open(file, get_dev_status_info, WP_PDE(inode)->data);
//return single_open(file, get_dev_status_info, WP_PDE_DATA(inode));
}
static struct file_operations wp_prot_dev_config_fops = {
@ -1259,6 +1259,65 @@ wandev_get_info_end:
#if defined(__LINUX__)
#ifdef LINUX_2_6
#define FPTR(st) (&st)
#else
#define FPTR(st) NULL
#endif
static inline struct proc_dir_entry *wp_proc_create(const char *name,
umode_t mode,
struct proc_dir_entry *parent,
struct file_operations *proc_fops)
{
struct proc_dir_entry *p = NULL;
#ifdef LINUX_3_0
p = proc_create(name, mode, parent, proc_fops);
#elif defined(LINUX_2_6)
p = create_proc_entry(name, mode, parent);
if (!p) {
return NULL;
}
p->proc_fops = proc_fops;
#elif defined(LINUX_2_4)
p = create_proc_entry(name, mode, parent);
if (!p) {
return NULL;
}
/* In 2.4 we always default to router_fops and router_inode */
if (!proc_fops) {
p->proc_fops = &router_fops;
}
p->proc_iops = &router_inode;
#else
p = create_proc_entry(name, mode, parent);
if (!p) {
return NULL;
}
/* In Pre-2.4 we always default to router_inode */
p->ops = &router_inode;
p->nlink = 1;
#endif
return p;
}
static inline struct proc_dir_entry *wp_proc_create_data(const char *name,
umode_t mode,
struct proc_dir_entry *parent,
struct file_operations *proc_fops, void *data)
{
struct proc_dir_entry *p = NULL;
#ifdef LINUX_3_0
p = proc_create_data(name, mode, parent, proc_fops, data);
#else
p = wp_proc_create(name, mode, parent, proc_fops);
if (p) {
p->data = data;
}
#endif
return p;
}
/*
* Initialize router proc interface.
*/
@ -1270,131 +1329,59 @@ int wanrouter_proc_init (void)
if (!proc_router)
goto fail;
p = create_proc_entry("config",S_IRUGO,proc_router);
p = wp_proc_create("config",S_IRUGO,proc_router,FPTR(config_fops));
if (!p)
goto fail_config;
#if defined(LINUX_2_6)
p->proc_fops = &config_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = config_get_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = config_get_info;
#endif
p = create_proc_entry("status",S_IRUGO,proc_router);
p = wp_proc_create("status",S_IRUGO,proc_router,FPTR(status_fops));
if (!p)
goto fail_stat;
#if defined(LINUX_2_6)
p->proc_fops = &status_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = status_get_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = status_get_info;
#endif
p = create_proc_entry("hwprobe",0,proc_router);
p = wp_proc_create("hwprobe",0,proc_router,FPTR(wp_hwprobe_fops));
if (!p)
goto fail_probe;
#if defined(LINUX_2_6)
p->proc_fops = &wp_hwprobe_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = probe_get_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = probe_get_info;
#endif
p = create_proc_entry("hwprobe_legacy",0,proc_router);
p = wp_proc_create("hwprobe_legacy",0,proc_router,FPTR(wp_hwprobe_legacy_fops));
if (!p)
goto fail_probe_legacy;
#if defined(LINUX_2_6)
p->proc_fops = &wp_hwprobe_legacy_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = probe_get_info_legacy;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = probe_get_info_legacy;
#endif
p = create_proc_entry("hwprobe_verbose",0,proc_router);
p = wp_proc_create("hwprobe_verbose",0,proc_router,FPTR(wp_hwprobe_verbose_fops));
if (!p)
goto fail_probe_verbose;
#if defined(LINUX_2_6)
p->proc_fops = &wp_hwprobe_verbose_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = probe_get_info_verbose;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = probe_get_info_verbose;
#endif
p = create_proc_entry("hwprobe_dump",0,proc_router);
p = wp_proc_create("hwprobe_dump",0,proc_router,FPTR(wp_hwprobe_dump_fops));
if (!p)
goto fail_probe_dump;
#if defined(LINUX_2_6)
p->proc_fops = &wp_hwprobe_dump_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = probe_get_info_dump;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = probe_get_info_dump;
#endif
p = create_proc_entry("map",0,proc_router);
p = wp_proc_create("map",0,proc_router,FPTR(wp_map_fops));
if (!p)
goto fail_map;
#if defined(LINUX_2_6)
p->proc_fops = &wp_map_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = map_get_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = map_get_info;
#endif
p = create_proc_entry("interfaces",0,proc_router);
p = wp_proc_create("interfaces",0,proc_router,FPTR(wp_iface_fops));
if (!p)
goto fail_interfaces;
#if defined(LINUX_2_6)
p->proc_fops = &wp_iface_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = interfaces_get_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#ifndef LINUX_2_6
p->get_info = interfaces_get_info;
#endif
@ -1435,14 +1422,6 @@ fail:
return -ENOMEM;
}
int wanrouter_proc_usage_check(void)
{
if (proc_router){
return atomic_read(&proc_router->count);
}
return 0;
}
/*
* Clean up router proc interface.
*/
@ -1475,45 +1454,31 @@ int wanrouter_proc_add (wan_device_t* wandev)
return -EINVAL;
wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router);
wandev->dent = wp_proc_create_data(wandev->name, S_IRUGO, proc_router, FPTR(wandev_fops), wandev);
if (!wandev->dent)
return -ENOMEM;
#if defined(LINUX_2_6)
wandev->dent->proc_fops = &wandev_fops;
#elif defined(LINUX_2_4)
wandev->dent->proc_fops = &wandev_fops;
wandev->dent->proc_iops = &router_inode;
wandev->dent->get_info = wandev_get_info;
#else
wandev->dent->ops = &wandev_inode;
wandev->dent->nlink = 1;
#if !defined(LINUX_2_6)
wandev->dent->get_info = wandev_get_info;
#endif
wandev->dent->data = wandev;
p=create_proc_entry(wandev->name, 0, map_dir);
p = wp_proc_create_data(wandev->name, 0, map_dir, FPTR(wandev_mapdir_fops), wandev);
if (!p){
remove_proc_entry(wandev->name, proc_router);
wandev->dent=NULL;
return -ENOMEM;
}
#if defined(LINUX_2_6)
//FIXME: ADD THE FOPS HERE
p->proc_fops = &wandev_mapdir_fops;
#elif defined(LINUX_2_4)
#if !defined(LINUX_2_6)
#if defined(LINUX_2_4)
p->proc_fops = &wandev_fops;
p->proc_iops = &router_inode;
p->get_info = wandev_mapdir_get_info;
#else
p->ops = &wandev_inode;
p->nlink = 1;
p->get_info = wandev_mapdir_get_info;
#endif
p->data = wandev;
#endif
return err;
}
@ -1578,43 +1543,20 @@ int wanrouter_proc_add_protocol(wan_device_t* wandev)
goto fail;
/* Create /proc/net/wanrouter/<protocol>/config directory */
p = create_proc_entry("config",0,proc_protocol->protocol_entry);
p = wp_proc_create_data("config",0,proc_protocol->protocol_entry,FPTR(wp_get_dev_config_fops),((void *)(long)wandev->config_id));
if (!p)
goto fail_config;
#if defined(LINUX_2_6)
p->proc_fops = &wp_get_dev_config_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = get_dev_config_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#if !defined(LINUX_2_6)
p->get_info = get_dev_config_info;
#endif
p->data = (void*)wandev->config_id;
/* Create /proc/net/wanrouter/<protocol>/status directory */
p = create_proc_entry("status",0,proc_protocol->protocol_entry);
p = wp_proc_create_data("status",0,proc_protocol->protocol_entry,FPTR(wp_get_dev_status_fops),((void *)(long)wandev->config_id));
if (!p)
goto fail_stat;
#if defined(LINUX_2_6)
p->proc_fops = &wp_get_dev_status_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = get_dev_status_info;
#else
p->ops = &router_inode;
p->nlink = 1;
#if !defined(LINUX_2_6)
p->get_info = get_dev_status_info;
#endif
p->data = (void*)wandev->config_id;
}
/* Create /proc/net/wanrouter/<protocol>/<wanpipe#> directory */
@ -1623,24 +1565,13 @@ int wanrouter_proc_add_protocol(wan_device_t* wandev)
goto fail_link;
/* Create /proc/net/wanrouter/<protocol>/<wanpipe#>config directory */
p = create_proc_entry("config",0,wandev->link);
p = wp_proc_create_data("config",0,wandev->link,NULL,wandev);
if (!p)
goto fail_link_config;
#if defined(LINUX_2_6)
p->proc_fops = NULL; //&wp_prot_dev_config_fops;
#elif defined(LINUX_2_4)
p->proc_fops = &router_fops;
p->proc_iops = &router_inode;
p->get_info = wandev->get_dev_config_info;
p->write_proc = wandev->set_dev_config;
#else
p->ops = &router_inode;
p->nlink = 1;
#if !defined(LINUX_2_6)
p->get_info = wandev->get_dev_config_info;
p->write_proc = wandev->set_dev_config;
#endif
p->data = wandev;
proc_protocol->count ++;
return 0;

11
rpmspec/wanpipe-mod.rpmspec

@ -1,6 +1,6 @@
%define WANPIPE_VER wanpipe-modules
%define name %{WANPIPE_VER}
%define version 7.0.8
%define version 7.0.9
%define release 0
%define serial 1
%define MODULES_DIR /lib/modules
@ -59,6 +59,15 @@ fi
%changelog
* Mon Jan 7 2014 Nenad Corbic <ncorbic@sangoma.com> - 7.0.9
==================================================================
- Support for Dahdi 2.8
- Support for Centos 6.5
- Support for kernels up to 3.12
- Fixes A116 clocking for dahdi when link is down
- Updates to A116 for possible NMI interrupt erros on some motherboards.
* Wed Nov 14 2013 Nenad Corbic <ncorbic@sangoma.com> - 7.0.8
==================================================================

11
rpmspec/wanpipe-util.rpmspec

@ -1,6 +1,6 @@
%define WANPIPE_VER wanpipe-util
%define name %{WANPIPE_VER}
%define version 7.0.8
%define version 7.0.9
%define release 0
%define serial 1
%define UTILS_DIR /usr/sbin
@ -229,6 +229,15 @@ chmod 755 /usr/local/sbin/setup-sangoma
%changelog
* Mon Jan 7 2014 Nenad Corbic <ncorbic@sangoma.com> - 7.0.9
==================================================================
- Support for Dahdi 2.8
- Support for Centos 6.5
- Support for kernels up to 3.12
- Fixes A116 clocking for dahdi when link is down
- Updates to A116 for possible NMI interrupt erros on some motherboards.
* Wed Nov 14 2013 Nenad Corbic <ncorbic@sangoma.com> - 7.0.8