mISDN patchset for next
Subsystems (3)
v2 cover mISDN patchset for next
This is a update of the mISDN driver for net-next.
It syncs the mISDN driver with the development on git.misdn.org. More updates (new hardware support) will follow.
You can pull it fromgit://master.kernel.org/pub/scm/linux/kernel/git/kkeil/ISDN-2.6-net-next.git for_dave
Andreas Eversberg (12):
Add watchdog functionality to hfcmulti driver
DSP now uses ring buffer for echo canceler
Echo canceler now gets delay information from hardware Fixed missing spin lock on pipeline process
Added layer-1-hold feature
Fix DTMF locking bug issue
Hardware acceleration is now possible in conjunction with audio
recording
Fix TEI and SAPI handling
Add "sapi" information to debug messages
Add PCI ID for Junghanns 8S card
Added PCI ID for new Junghanns.net Single E1 cards. Fix DTMF detection enable/disable
Arnaldo Carvalho de Melo (1):
Use kernel_{send,recv}msg instead of open coding
Frank Seidel (2):
Reduce stack size in dsp_cmx_send()
Add allocation of recvbuf[1500] at run time to reduce stack size
Karsten Keil (3):
Fix skb leak in error cases
Add XHFC support for embedded Speech-Design board to hfcmulti Cleanup debug messages
Roel Kluin (1):
isdn: get_free_devid() failure ignored
drivers/isdn/hardware/mISDN/Kconfig | 11 +- drivers/isdn/hardware/mISDN/hfc_multi.h | 47 ++- drivers/isdn/hardware/mISDN/hfc_multi_8xx.h | 167 ++++++++ drivers/isdn/hardware/mISDN/hfcmulti.c | 614 ++++++++++++++++++--------- drivers/isdn/hardware/mISDN/hfcpci.c | 98 +++-- drivers/isdn/hardware/mISDN/hfcsusb.c | 4 +- drivers/isdn/mISDN/core.c | 8 +- drivers/isdn/mISDN/dsp.h | 19 +- drivers/isdn/mISDN/dsp_audio.c | 5 +- drivers/isdn/mISDN/dsp_cmx.c | 115 ++++-- drivers/isdn/mISDN/dsp_core.c | 72 ++-- drivers/isdn/mISDN/dsp_dtmf.c | 3 + drivers/isdn/mISDN/dsp_ecdis.h | 2 +- drivers/isdn/mISDN/dsp_pipeline.c | 5 +- drivers/isdn/mISDN/dsp_tones.c | 23 +- drivers/isdn/mISDN/hwchannel.c | 4 +- drivers/isdn/mISDN/l1oip.h | 2 +- drivers/isdn/mISDN/l1oip_codec.c | 1 + drivers/isdn/mISDN/l1oip_core.c | 71 ++-- drivers/isdn/mISDN/layer2.c | 37 +- drivers/isdn/mISDN/layer2.h | 2 +- drivers/isdn/mISDN/socket.c | 45 ++- drivers/isdn/mISDN/tei.c | 80 +++-- drivers/isdn/mISDN/timerdev.c | 2 +- include/linux/mISDNdsp.h | 4 +- include/linux/mISDNhw.h | 2 +- include/linux/mISDNif.h | 19 +- include/linux/pci_ids.h | 2 + 28 files changed, 994 insertions(+), 470 deletions(-) create mode 100644 drivers/isdn/hardware/mISDN/hfc_multi_8xx.h
PATCH v2 1/19 Add watchdog functionality to hfcmulti driver
From: Andreas Eversberg <[email protected]>
This patch was made by Titus Moldovan and provides IOCTL functions for enabling and disabling the controller's built in watchdog. The use is optional.
--- drivers/isdn/hardware/mISDN/hfc_multi.h | 1 + drivers/isdn/hardware/mISDN/hfcmulti.c | 32 ++++++++++++++++++++++++++++++- include/linux/mISDNif.h | 3 +- 3 files changed, 34 insertions(+), 2 deletions(-)
drivers/isdn/hardware/mISDN/hfc_multi.h +1 -0
@@ -62,6 +62,7 @@ struct hfcm_hw {u_char r_sci_msk;u_char r_tx0, r_tx1;u_char a_st_ctrl0[8 ]; +u_char r_bert_wd_md;timer_t timer; };
drivers/isdn/hardware/mISDN/hfcmulti.c +31 -1
@@ -4013,11 +4013,41 @@ open_bchannel(struct hfc_multi *hc, struct dchannel *dch,static int channel_dctrl (struct dchannel *dch,struct mISDN_ctrl_req *cq) { +struct hfc_multi *hc = dch->hw;int ret =0 ; +int wd_mode, wd_cnt;switch (cq->op) {case MISDN_CTRL_GETOP : - cq->op =0 ; + cq->op =MISDN_CTRL_HFC_OP ; +break ; +case MISDN_CTRL_HFC_WD_INIT :/* init the watchdog */ + wd_cnt = cq->p1 &0xf ; + wd_mode = !!(cq->p1 >>4 ); +if (debug &DEBUG_HFCMULTI_MSG ) +printk (KERN_DEBUG +"%s: MISDN_CTRL_HFC_WD_INIT mode %s counter 0x%x\n" , + __func__, wd_mode ?"AUTO" :"MANUAL" , wd_cnt); +/* set the watchdog timer */ +HFC_outb (hc,R_TI_WD , poll_timer | (wd_cnt <<4 )); + hc->hw.r_bert_wd_md = (wd_mode ?V_AUTO_WD_RES :0 ); +if (hc->ctype ==HFC_TYPE_XHFC ) + hc->hw.r_bert_wd_md |=0x40 /* V_WD_EN */ ; +/* init the watchdog register and reset the counter */ +HFC_outb (hc,R_BERT_WD_MD , hc->hw.r_bert_wd_md |V_WD_RES ); +if (test_bit (HFC_CHIP_PLXSD , &hc->chip)) { +/* enable the watchdog output for Speech-Design */ +HFC_outb (hc,R_GPIO_SEL ,V_GPIO_SEL7 ); +HFC_outb (hc,R_GPIO_EN1 ,V_GPIO_EN15 ); +HFC_outb (hc,R_GPIO_OUT1 ,0 ); +HFC_outb (hc,R_GPIO_OUT1 ,V_GPIO_OUT15 ); + } +break ; +case MISDN_CTRL_HFC_WD_RESET :/* reset the watchdog counter */ +if (debug &DEBUG_HFCMULTI_MSG ) +printk (KERN_DEBUG "%s: MISDN_CTRL_HFC_WD_RESET\n" , + __func__); +HFC_outb (hc,R_BERT_WD_MD , hc->hw.r_bert_wd_md |V_WD_RES );break ;default : printk(KERN_WARNING "%s: unknown Op %x\n",
include/linux/mISDNif.h +2 -1
@@ -362,7 +362,8 @@ clear_channelmap(u_int nr, u_char *map)#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008 - +#define MISDN_CTRL_HFC_WD_INIT 0x4009 +#define MISDN_CTRL_HFC_WD_RESET 0x400A/* socket options */ #define MISDN_TIME_STAMP 0x0001
Signature · 1 line
1.6.0.2
PATCH v2 2/19 DSP now uses ring buffer for echo canceler
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
DSP now uses ring buffer for echo canceler.
Added missing include in l1oip_codec.c
--- drivers/isdn/mISDN/dsp.h | 3 ++- drivers/isdn/mISDN/l1oip_codec.c | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/mISDN/dsp.h +2 -1
@@ -112,7 +112,8 @@ struct dsp_conf {#define DSP_DTMF_NPOINTS 102 -#define ECHOCAN_BUFLEN (4*128) +#define ECHOCAN_BUFF_SIZE 0x400/* must be 2**n */ +#define ECHOCAN_BUFF_MASK 0x3ff/* -1 */ struct dsp_dtmf {int treshold;/* above this is dtmf (square of) */
drivers/isdn/mISDN/l1oip_codec.c +1 -0
@@ -48,6 +48,7 @@ NOTE: The bytes are handled as they are law-encoded.#include <linux/vmalloc.h> #include <linux/mISDNif.h> +#include <linux/in.h> #include "core.h" #include "l1oip.h"
Signature · 1 line
1.6.0.2
PATCH v2 3/19 Echo canceler now gets delay information from hardware
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
Added tx-fifo information for calculation of current delay to sync tx and rx streams for echo canceler.
--- drivers/isdn/hardware/mISDN/hfc_multi.h | 1 + drivers/isdn/hardware/mISDN/hfcmulti.c | 8 +++- drivers/isdn/hardware/mISDN/hfcpci.c | 70 ++++++++++++++++++------------- drivers/isdn/hardware/mISDN/hfcsusb.c | 4 +- drivers/isdn/mISDN/dsp.h | 2 +- drivers/isdn/mISDN/dsp_core.c | 2 +- drivers/isdn/mISDN/dsp_pipeline.c | 5 +- drivers/isdn/mISDN/hwchannel.c | 4 +- include/linux/mISDNdsp.h | 3 +- include/linux/mISDNhw.h | 2 +- 10 files changed, 60 insertions(+), 41 deletions(-)
drivers/isdn/hardware/mISDN/hfc_multi.h +1 -0
@@ -44,6 +44,7 @@ struct hfc_chan {int conf;/* conference setting of TX slot */ int txpending;/* if there is currently data in */ /* the FIFO 0=no, 1=yes, 2=splloop */ +int Zfill;/* rx-fifo level on last hfcmulti_tx */ int rx_off;/* set to turn fifo receive off */ int coeff_count;/* curren coeff block */ s32 *coeff;/* memory pointer to 8 coeff blocks */
drivers/isdn/hardware/mISDN/hfcmulti.c +6 -2
@@ -1945,6 +1945,9 @@ next_frame: "%d!=%d\n", __func__, hc->id + 1, temp, z2); z2 = temp;/* repeat unti Z2 is equal */ } + hc->chan[ch].Zfill = z1 - z2; +if (hc->chan[ch].Zfill <0 ) + hc->chan[ch].Zfill += hc->Zlen; Zspace = z2 - z1;if (Zspace <=0 ) Zspace += hc->Zlen;
@@ -2031,6 +2034,7 @@ next_frame:/* Have to prep the audio data */ hc->write_fifo (hc, d, ii - i); + hc->chan[ch].Zfill += ii - i; *idxp = ii;/* if not all data has been written */
@@ -2226,7 +2230,7 @@ next_frame:if (dch)recv_Dchannel (dch);else -recv_Bchannel (bch); +recv_Bchannel (bch,MISDN_ID_ANY ); *sp = skb; again++; goto next_frame;
@@ -2258,7 +2262,7 @@ next_frame:"(z1=%04x, z2=%04x) TRANS\n" , __func__, hc->id + 1, ch, Zsize, z1, z2);/* only bch is transparent */ -recv_Bchannel (bch); +recv_Bchannel (bch, hc->chan[ch].Zfill); *sp = skb; } }
drivers/isdn/hardware/mISDN/hfcpci.c +41 -29
138 lines not on this page · raw message
drivers/isdn/hardware/mISDN/hfcsusb.c +2 -2
@@ -947,7 +947,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,if (fifo->dch)recv_Dchannel (fifo->dch);if (fifo->bch) -recv_Bchannel (fifo->bch); +recv_Bchannel (fifo->bch,MISDN_ID_ANY );if (fifo->ech)recv_Echannel (fifo->ech, &hw->dch);
@@ -969,7 +969,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len, }else {/* deliver transparent data to layer2 */ if (rx_skb->len >= poll) -recv_Bchannel (fifo->bch); +recv_Bchannel (fifo->bch,MISDN_ID_ANY ); }spin_unlock (&hw->lock); }
drivers/isdn/mISDN/dsp.h +1 -1
@@ -262,5 +262,5 @@ extern int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg);extern void dsp_pipeline_process_tx (struct dsp_pipeline *pipeline,u8 *data,int len);extern void dsp_pipeline_process_rx (struct dsp_pipeline *pipeline,u8 *data, -int len); +int len,unsigned int txlen);
drivers/isdn/mISDN/dsp_core.c +1 -1
@@ -710,7 +710,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb)/* pipeline */ if (dsp->pipeline.inuse)dsp_pipeline_process_rx (&dsp->pipeline, skb->data, - skb->len); + skb->len, hh->id);/* change volume if requested */ if (dsp->rx_volume)dsp_change_volume (skb, dsp->rx_volume);
drivers/isdn/mISDN/dsp_pipeline.c +3 -2
@@ -347,7 +347,8 @@ void dsp_pipeline_process_tx(struct dsp_pipeline *pipeline, u8 *data, int len) entry->elem->process_tx (entry->p, data, len); } -void dsp_pipeline_process_rx (struct dsp_pipeline *pipeline,u8 *data,int len) +void dsp_pipeline_process_rx (struct dsp_pipeline *pipeline,u8 *data,int len, +unsigned int txlen) {struct dsp_pipeline_entry *entry;
@@ -356,7 +357,7 @@ void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data, int len)list_for_each_entry_reverse (entry, &pipeline->list, list)if (entry->elem->process_rx) - entry->elem->process_rx (entry->p, data, len); + entry->elem->process_rx (entry->p, data, len, txlen); }
drivers/isdn/mISDN/hwchannel.c +2 -2
@@ -185,13 +185,13 @@ recv_Echannel(struct dchannel *ech, struct dchannel *dch)EXPORT_SYMBOL (recv_Echannel);void -recv_Bchannel (struct bchannel *bch) +recv_Bchannel (struct bchannel *bch,unsigned int id) {struct mISDNhead *hh; hh =mISDN_HEAD_P (bch->rx_skb); hh->prim =PH_DATA_IND ; - hh->id =MISDN_ID_ANY ; + hh->id = id;if (bch->rcount >=64 ) {printk (KERN_WARNING "B-channel %p receive queue overflow, " "fushing!\n" , bch);
include/linux/mISDNdsp.h +2 -1
@@ -12,7 +12,8 @@ struct mISDN_dsp_element {void *(*new)(const char *arg);void (*free)(void *p);void (*process_tx)(void *p,unsigned char *data,int len); -void (*process_rx)(void *p,unsigned char *data,int len); +void (*process_rx)(void *p,unsigned char *data,int len, +unsigned int txlen);int num_args;struct mISDN_dsp_element_arg *args;
include/linux/mISDNhw.h +1 -1
@@ -185,7 +185,7 @@ extern int dchannel_senddata(struct dchannel *, struct sk_buff *);extern int bchannel_senddata (struct bchannel *,struct sk_buff *);extern void recv_Dchannel (struct dchannel *);extern void recv_Echannel (struct dchannel *,struct dchannel *); -extern void recv_Bchannel (struct bchannel *); +extern void recv_Bchannel (struct bchannel *,unsigned int id);extern void recv_Dchannel_skb (struct dchannel *,struct sk_buff *);extern void recv_Bchannel_skb (struct bchannel *,struct sk_buff *);extern void confirm_Bsend (struct bchannel *bch);
Signature · 1 line
1.6.0.2
PATCH v2 4/19 Fixed missing spin lock on pipeline process
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
Need to protect the complete pipeline.
--- drivers/isdn/mISDN/dsp_core.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/isdn/mISDN/dsp_core.c +3 -1
@@ -704,6 +704,8 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb)break ; } +spin_lock_irqsave (&dsp_lock, flags); +/* decrypt if enabled */ if (dsp->bf_enable)dsp_bf_decrypt (dsp, skb->data, skb->len);
@@ -741,11 +743,11 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) } }/* we need to process receive data if software */ -spin_lock_irqsave (&dsp_lock, flags);if (dsp->pcm_slot_tx <0 && dsp->pcm_slot_rx <0 ) {/* process data from card at cmx */ dsp_cmx_receive (dsp, skb); } +spin_unlock_irqrestore (&dsp_lock, flags);if (dsp->rx_disabled) {
Signature · 1 line
1.6.0.2
PATCH v2 5/19 Reduce stack size in dsp_cmx_send()
In reply to Karsten KeilFrom: Frank Seidel <[email protected]>
Reduce stack size memory footprint of mISDN_dsp. (From 1468 bytes for dsp_cmx_send on i386 down to 44).
--- drivers/isdn/hardware/mISDN/hfcmulti.c | 2 +- drivers/isdn/mISDN/dsp_cmx.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/isdn/hardware/mISDN/hfcmulti.c +1 -1
@@ -104,7 +104,7 @@* If unsure, don't give this parameter. * * dslot: -* NOTE: only one poll value must be given for every card. +* NOTE: only one dslot value must be given for every card. * Also this value must be given for non-E1 cards. If omitted, the E1 * card has D-channel on time slot 16, which is default. * If 1..15 or 17..31, an alternate time slot is used for D-channel.
drivers/isdn/mISDN/dsp_cmx.c +2 -1
@@ -1592,7 +1592,8 @@ dsp_cmx_send(void *arg)struct dsp_conf_member *member;struct dsp *dsp;int mustmix, members; -s32 mixbuffer[MAX_POLL +100 ], *c; +static s32 mixbuffer[MAX_POLL +100 ]; +s32 *c;u8 *p, *q;int r, rr;int jittercheck =0 , delay, i;
Signature · 1 line
1.6.0.2
PATCH v2 6/19 Added layer-1-hold feature
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
Add IMHOLD_L1 ioctl.
The feature will be disabled on closing.
--- drivers/isdn/mISDN/socket.c | 21 ++++++++++++++++++--- drivers/isdn/mISDN/tei.c | 43 +++++++++++++++++++++++++++++++------------ include/linux/mISDNif.h | 2 ++ 3 files changed, 51 insertions(+), 15 deletions(-)
drivers/isdn/mISDN/socket.c +18 -3
@@ -292,7 +292,7 @@ static int data_sock_ioctl_bound(struct sock *sk, unsigned int cmd, void __user *p) { struct mISDN_ctrl_req cq; -int err = -EINVAL , val; +int err = -EINVAL , val[2 ];struct mISDNchannel *bchan, *next;lock_sock (sk);
@@ -328,12 +328,27 @@ data_sock_ioctl_bound(struct sock *sk, unsigned int cmd, void __user *p) err = -EINVAL ;break ; } -if (get_user (val, (int __user *)p)) { + val[0 ] = cmd; +if (get_user (val[1 ], (int __user *)p)) { err = -EFAULT ;break ; } err =_pms (sk)->dev->teimgr->ctrl (_pms (sk)->dev->teimgr, -CONTROL_CHANNEL , &val); +CONTROL_CHANNEL , val); +break ; +case IMHOLD_L1 : +if (sk->sk_protocol !=ISDN_P_LAPD_NT + && sk->sk_protocol !=ISDN_P_LAPD_TE ) { + err = -EINVAL ; +break ; + } + val[0 ] = cmd; +if (get_user (val[1 ], (int __user *)p)) { + err = -EFAULT ; +break ; + } + err =_pms (sk)->dev->teimgr->ctrl (_pms (sk)->dev->teimgr, +CONTROL_CHANNEL , val);break ;default : err = -EINVAL ;
drivers/isdn/mISDN/tei.c +31 -12
67 lines not on this page · raw message
include/linux/mISDNif.h +2 -0
@@ -229,6 +229,7 @@#define OPTION_L2_PTP 2#define OPTION_L2_FIXEDTEI 3#define OPTION_L2_CLEANUP 4 +#define OPTION_L1_HOLD 5/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */ #define MISDN_MAX_IDLEN 20
@@ -317,6 +318,7 @@ struct ph_info {#define IMCTRLREQ _IOR('I', 69, int)#define IMCLEAR_L2 _IOR('I', 70, int)#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename) +#define IMHOLD_L1 _IOR('I', 72, int)static inline int test_channelmap (u_int nr,u_char *map)
Signature · 1 line
1.6.0.2
PATCH v2 7/19 Fix DTMF locking bug issue
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
DTMF digits were sent up to socket in locked state. Receive audio stream was not enabled in certain condition.
--- drivers/isdn/hardware/mISDN/hfcmulti.c | 4 +- drivers/isdn/mISDN/dsp.h | 2 +- drivers/isdn/mISDN/dsp_core.c | 37 +++++++++++++++++-------------- 3 files changed, 23 insertions(+), 20 deletions(-)
drivers/isdn/hardware/mISDN/hfcmulti.c +2 -2
@@ -1817,8 +1817,8 @@ hfcmulti_dtmf(struct hfc_multi *hc) coeff[(co<<1 )|1 ] = mantissa; }if (debug &DEBUG_HFCMULTI_DTMF ) -printk ("%s: DTMF ready %08x %08x %08x %08x " -"%08x %08x %08x %08x\n" , __func__, +printk (" DTMF ready %08x %08x %08x %08x " +"%08x %08x %08x %08x\n" , coeff[0 ], coeff[1 ], coeff[2 ], coeff[3 ], coeff[4 ], coeff[5 ], coeff[6 ], coeff[7 ]); hc->chan[ch].coeff_count++;
drivers/isdn/mISDN/dsp.h +1 -1
@@ -124,7 +124,7 @@ struct dsp_dtmf {/* buffers one full dtmf frame */ u8 lastwhat, lastdigit;int count; -u8 digits[16 ];/* just the dtmf result */ +u8 digits[16 ];/* dtmf result */ };
drivers/isdn/mISDN/dsp_core.c +20 -17
@@ -311,6 +311,7 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb)/* check dtmf hardware */ dsp_dtmf_hardware (dsp); +dsp_rx_off (dsp);break ;case DTMF_TONE_STOP :/* turn off DTMF */ if (dsp_debug &DEBUG_DSP_CORE )
@@ -657,11 +658,10 @@ get_features(struct mISDNchannel *ch)static int dsp_function (struct mISDNchannel *ch,struct sk_buff *skb) { - struct dsp *dsp = container_of(ch, struct dsp, ch); + struct dsp *dsp = container_of(ch, struct dsp, ch);struct mISDNhead *hh;int ret =0 ; -u8 *digits; -int cont; +u8 *digits =NULL ;u_long flags; hh =mISDN_HEAD_P (skb);
@@ -716,40 +716,43 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb)/* change volume if requested */ if (dsp->rx_volume)dsp_change_volume (skb, dsp->rx_volume); -/* check if dtmf soft decoding is turned on */ if (dsp->dtmf.software) { digits =dsp_dtmf_goertzel_decode (dsp, skb->data, skb->len, (dsp_options&DSP_OPT_ULAW )?1 :0 ); + } +/* we need to process receive data if software */ +if (dsp->pcm_slot_tx <0 && dsp->pcm_slot_rx <0 ) { +/* process data from card at cmx */ +dsp_cmx_receive (dsp, skb); + } + +spin_unlock_irqrestore (&dsp_lock, flags); + +/* send dtmf result, if any */ +if (digits) {while (*digits) { +int k;struct sk_buff *nskb;if (dsp_debug &DEBUG_DSP_DTMF )printk (KERN_DEBUG "%s: digit" "(%c) to layer %s\n" , __func__, *digits, dsp->name); - cont =DTMF_TONE_VAL | *digits; + k = *digits |DTMF_TONE_VAL ; nskb =_alloc_mISDN_skb (PH_CONTROL_IND , -MISDN_ID_ANY ,sizeof (int ), &cont, -GFP_ATOMIC ); +MISDN_ID_ANY ,sizeof (int ), &k, +GFP_ATOMIC );if (nskb) {if (dsp->up) {if (dsp->up->send ( dsp->up, nskb)) -dev_kfree_skb (nskb); +dev_kfree_skb (nskb); }else dev_kfree_skb (nskb); } digits++; } } -/* we need to process receive data if software */ -if (dsp->pcm_slot_tx <0 && dsp->pcm_slot_rx <0 ) { -/* process data from card at cmx */ -dsp_cmx_receive (dsp, skb); - } - -spin_unlock_irqrestore (&dsp_lock, flags); -if (dsp->rx_disabled) {/* if receive is not allowed */ break ;
@@ -789,7 +792,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb)if (dsp->up) {if (dsp->up->send ( dsp->up, nskb)) -dev_kfree_skb (nskb); +dev_kfree_skb (nskb); }else dev_kfree_skb (nskb); }
Signature · 1 line
1.6.0.2
PATCH v2 8/19 Hardware acceleration is now possible in conjunction with audio recording
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
Audio recording requires software audio processing.
Both hardware and software processing is simultaniously possible now.
--- drivers/isdn/mISDN/dsp.h | 11 ++++- drivers/isdn/mISDN/dsp_cmx.c | 101 ++++++++++++++++++++++++++--------------- drivers/isdn/mISDN/dsp_core.c | 17 ++++--- 3 files changed, 84 insertions(+), 45 deletions(-)
drivers/isdn/mISDN/dsp.h +10 -1
@@ -151,6 +151,15 @@ struct dsp_tone {struct timer_list tl; }; +/*************** +* echo stuff * +***************/ + +struct dsp_echo { +int software;/* echo is generated by software */ +int hardware;/* echo is generated by hardware */ +}; +/***************** * general stuff * *****************/
@@ -161,7 +170,7 @@ struct dsp {struct mISDNchannel *up;unsigned char name[64 ];int b_active; -int echo;/* echo is enabled */ +struct dsp_echo echo;int rx_disabled;/* what the user wants */ int rx_is_off;/* what the card is */ int tx_mix;
drivers/isdn/mISDN/dsp_cmx.c +65 -36
238 lines not on this page · raw message
drivers/isdn/mISDN/dsp_core.c +9 -8
@@ -203,13 +203,13 @@ dsp_rx_off_member(struct dsp *dsp)else if (dsp->dtmf.software) rx_off =0 ;/* echo in software */ -else if (dsp->echo && dsp->pcm_slot_tx <0 ) +else if (dsp->echo.software) rx_off =0 ;/* bridge in software */ -else if (dsp->conf) { -if (dsp->conf->software) - rx_off =0 ; - } +else if (dsp->conf && dsp->conf->software) + rx_off =0 ; +/* data is not required by user space and not required +* for echo dtmf detection, soft-echo, soft-bridging */ if (rx_off == dsp->rx_is_off)return ;
@@ -415,7 +415,7 @@ tone_off:dsp_rx_off (dsp);break ;case DSP_ECHO_ON :/* enable echo */ - dsp->echo =1 ;/* soft echo */ + dsp->echo.software =1 ;/* soft echo */ if (dsp_debug &DEBUG_DSP_CORE )printk (KERN_DEBUG "%s: enable cmx-echo\n" , __func__);dsp_cmx_hardware (dsp->conf, dsp);
@@ -424,7 +424,8 @@ tone_off:dsp_cmx_debug (dsp);break ;case DSP_ECHO_OFF :/* disable echo */ - dsp->echo =0 ; + dsp->echo.software =0 ; + dsp->echo.hardware =0 ;if (dsp_debug &DEBUG_DSP_CORE )printk (KERN_DEBUG "%s: disable cmx-echo\n" , __func__);dsp_cmx_hardware (dsp->conf, dsp);
@@ -722,7 +723,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb) skb->len, (dsp_options&DSP_OPT_ULAW)?1:0); }/* we need to process receive data if software */ -if (dsp->pcm_slot_tx <0 && dsp->pcm_slot_rx <0 ) { +if (dsp->conf && dsp->conf->software) {/* process data from card at cmx */ dsp_cmx_receive (dsp, skb); }
Signature · 1 line
1.6.0.2
PATCH v2 9/19 Fix TEI and SAPI handling
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
Added SAPI value to use SAPIs different than 0.
Now fixed TEIs work in NT mode. This allows PTP endpoint to be connected to PTMP ports together with other PTMP endpoints.
--- drivers/isdn/mISDN/layer2.c | 13 +++++++------ drivers/isdn/mISDN/layer2.h | 2 +- drivers/isdn/mISDN/tei.c | 25 ++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-)
drivers/isdn/mISDN/layer2.c +7 -6
@@ -2068,7 +2068,8 @@ l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) }struct layer2 * -create_l2 (struct mISDNchannel *ch,u_int protocol,u_long options,u_long arg) +create_l2 (struct mISDNchannel *ch,u_int protocol,u_long options,u_int tei, +u_int sapi) {struct layer2 *l2;struct channel_req rq;
@@ -2089,7 +2090,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)test_and_set_bit (FLG_LAPD , &l2->flag);test_and_set_bit (FLG_LAPD_NET , &l2->flag);test_and_set_bit (FLG_MOD128 , &l2->flag); - l2->sapi =0 ; + l2->sapi = sapi; l2->maxlen =MAX_DFRAME_LEN ;if (test_bit (OPTION_L2_PMX , &options)) l2->window =7 ;
@@ -2099,7 +2100,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)test_and_set_bit (FLG_PTP , &l2->flag);if (test_bit (OPTION_L2_FIXEDTEI , &options))test_and_set_bit (FLG_FIXED_TEI , &l2->flag); - l2->tei = (u_int )arg; + l2->tei = tei; l2->T200 =1000 ; l2->N200 =3 ; l2->T203 =10000 ;
@@ -2114,7 +2115,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)test_and_set_bit (FLG_LAPD , &l2->flag);test_and_set_bit (FLG_MOD128 , &l2->flag);test_and_set_bit (FLG_ORIG , &l2->flag); - l2->sapi =0 ; + l2->sapi = sapi; l2->maxlen =MAX_DFRAME_LEN ;if (test_bit (OPTION_L2_PMX , &options)) l2->window =7 ;
@@ -2124,7 +2125,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)test_and_set_bit (FLG_PTP , &l2->flag);if (test_bit (OPTION_L2_FIXEDTEI , &options))test_and_set_bit (FLG_FIXED_TEI , &l2->flag); - l2->tei = (u_int )arg; + l2->tei = tei; l2->T200 =1000 ; l2->N200 =3 ; l2->T203 =10000 ;
@@ -2180,7 +2181,7 @@ x75create(struct channel_req *crq)if (crq->protocol !=ISDN_P_B_X75SLP )return -EPROTONOSUPPORT ; - l2 =create_l2 (crq->ch, crq->protocol,0 ,0 ); + l2 =create_l2 (crq->ch, crq->protocol,0 ,0 ,0 );if (!l2)return -ENOMEM ; crq->ch = &l2->ch;
drivers/isdn/mISDN/layer2.h +1 -1
@@ -90,7 +90,7 @@ enum {#define L2_STATE_COUNT (ST_L2_8+1)extern struct layer2 *create_l2 (struct mISDNchannel *,u_int , -u_long ,u_long ); +u_long ,u_int ,u_int );extern int tei_l2 (struct layer2 *,u_int ,u_long arg);
drivers/isdn/mISDN/tei.c +12 -13
@@ -777,7 +777,7 @@ tei_ph_data_ind(struct teimgr *tm, u_int mt, u_char *dp, int len) }static struct layer2 * -create_new_tei (struct manager *mgr,int tei) +create_new_tei (struct manager *mgr,int tei,int sapi) {u_long opt =0 ;u_long flags;
@@ -791,7 +791,7 @@ create_new_tei(struct manager *mgr, int tei)if (mgr->ch.st->dev->Dprotocols & ((1 <<ISDN_P_TE_E1 ) | (1 <<ISDN_P_NT_E1 )))test_and_set_bit (OPTION_L2_PMX , &opt); - l2 =create_l2 (mgr->up,ISDN_P_LAPD_NT , (u_int )opt, (u_long )tei); + l2 =create_l2 (mgr->up,ISDN_P_LAPD_NT , (u_int )opt, tei, sapi);if (!l2) {printk (KERN_WARNING "%s:no memory for layer2\n" , __func__);return NULL ;
@@ -839,12 +839,15 @@ new_tei_req(struct manager *mgr, u_char *dp) ri += dp[1 ];if (!mgr->up) goto denied; - tei =get_free_tei (mgr); +if (dp[3 ] !=0xff ) + tei = dp[3 ] >>1 ;/* 3GPP TS 08.56 6.1.11.2 */ +else + tei =get_free_tei (mgr);if (tei <0 ) {printk (KERN_WARNING "%s:No free tei\n" , __func__); goto denied; } - l2 =create_new_tei (mgr, tei); + l2 =create_new_tei (mgr, tei,0 );if (!l2) goto denied;else
@@ -976,8 +979,6 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) __func__,dev_name (&mgr->ch.st->dev->dev), crq->protocol, crq->adr.dev, crq->adr.channel, crq->adr.sapi, crq->adr.tei); -if (crq->adr.sapi !=0 )/* not supported yet */ -return -EINVAL ;if (crq->adr.tei >GROUP_TEI )return -EINVAL ;if (crq->adr.tei <64 )
@@ -1025,7 +1026,7 @@ create_teimgr(struct manager *mgr, struct channel_req *crq)return 0 ; } l2 =create_l2 (crq->ch, crq->protocol, (u_int )opt, - (u_long )crq->adr.tei); + crq->adr.tei, crq->adr.sapi);if (!l2)return -ENOMEM ; l2->tm =kzalloc (sizeof (struct teimgr ),GFP_KERNEL );
@@ -1166,7 +1167,7 @@ static int check_data(struct manager *mgr, struct sk_buff *skb) { struct mISDNhead *hh = mISDN_HEAD_P(skb); -int ret, tei; +int ret, tei, sapi;struct layer2 *l2;if (*debug &DEBUG_L2_CTRL )
@@ -1178,18 +1179,16 @@ check_data(struct manager *mgr, struct sk_buff *skb)return -ENOTCONN ;if (skb->len !=3 )return -ENOTCONN ; -if (skb->data[0 ] !=0 ) -/* only SAPI 0 command */ -return -ENOTCONN ; + sapi = skb->data[0 ] >>2 ;if (!(skb->data[1 ] &1 ))/* invalid EA1 */ return -EINVAL ; - tei = skb->data[1 ] >>0 ; + tei = skb->data[1 ] >>1 ;if (tei >63 )/* not a fixed tei */ return -ENOTCONN ;if ((skb->data[2 ] & ~0x10 ) !=SABME )return -ENOTCONN ;/* We got a SABME for a fixed TEI */ - l2 =create_new_tei (mgr, tei); + l2 =create_new_tei (mgr, tei, sapi);if (!l2)return -ENOMEM ; ret = l2->ch.send (&l2->ch, skb);
Signature · 1 line
1.6.0.2
Re: [mISDN PATCH v2 09/19] Fix TEI and SAPI handling
Hi Karsten.
Flash from the past looking at some ISDN layer2.
Some comments below.
Sam
drivers/isdn/mISDN/layer2.c l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) · line 2072
Quoted 4 lines
struct layer2 *
drivers/isdn/mISDN/layer2.c +2
-1-create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg) +create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_int tei, + u_int sapi)
Unrealted to this specific patch...
Are there any specific reason why mISDN prefer bsd style (u_int) rather then linux style (u32)?
drivers/isdn/mISDN/tei.c tei_ph_data_ind(struct teimgr *tm, u_int mt, u_char *dp, int len) · line 781
Quoted 5 lines
static struct layer2 *
drivers/isdn/mISDN/tei.c +1
-1-create_new_tei(struct manager *mgr, int tei) +create_new_tei(struct manager *mgr, int tei, int sapi) {
Here tei and sapi are passed as signed.
But valid sapi range is [0..63] and tei [0..127].
And create_l2 above uses unsigned.
This looks confusing.
Quoted 12 lines
drivers/isdn/mISDN/tei.c +1
-1u_long opt =0 ;u_long flags;@@ -791,7 +791,7 @@ create_new_tei(struct manager *mgr, int tei)if (mgr->ch.st->dev->Dprotocols & ((1 <<ISDN_P_TE_E1 ) | (1 <<ISDN_P_NT_E1 )))test_and_set_bit (OPTION_L2_PMX , &opt); - l2 =create_l2 (mgr->up,ISDN_P_LAPD_NT , (u_int )opt, (u_long )tei); + l2 =create_l2 (mgr->up,ISDN_P_LAPD_NT , (u_int )opt, tei, sapi);if (!l2) {printk (KERN_WARNING "%s:no memory for layer2\n" , __func__);return NULL ;
drivers/isdn/mISDN/tei.c new_tei_req(struct manager *mgr, u_char *dp) · line 845
Quoted 8 lines
drivers/isdn/mISDN/tei.c +4
-1@@ -839,12 +839,15 @@ new_tei_req(struct manager *mgr, u_char *dp) ri += dp[1 ];if (!mgr->up) goto denied; - tei =get_free_tei (mgr); +if (dp[3 ] !=0xff ) + tei = dp[3 ] >>1 ;/* 3GPP TS 08.56 6.1.11.2 */ +else + tei =get_free_tei (mgr);
You should check EA0 here before assuming that any values except EA=1, tei=127 equals ptmp.
drivers/isdn/mISDN/tei.c new_tei_req(struct manager *mgr, u_char *dp) · line 849
Quoted 4 lines
drivers/isdn/mISDN/tei.c +0
-0if (tei <0 ) {printk (KERN_WARNING "%s:No free tei\n" , __func__); goto denied; }
So get_free_tei() may return a negative value indicating no free tei. So that make my comment above void - but is this really the best way to return an error. Possibly it is..
drivers/isdn/mISDN/tei.c new_tei_req(struct manager *mgr, u_char *dp) · line 850
Quoted 2 lines
drivers/isdn/mISDN/tei.c +1
-1- l2 =create_new_tei (mgr, tei); + l2 =create_new_tei (mgr, tei,0 );
In general I would prefer to read: SAPI_CALLCONTROL rahter than a hardcoded 0.
Quoted 31 lines
drivers/isdn/mISDN/tei.c +2
-4if (!l2) goto denied;else @@ -976,8 +979,6 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) __func__,dev_name (&mgr->ch.st->dev->dev), crq->protocol, crq->adr.dev, crq->adr.channel, crq->adr.sapi, crq->adr.tei); -if (crq->adr.sapi !=0 )/* not supported yet */ -return -EINVAL ;if (crq->adr.tei >GROUP_TEI )return -EINVAL ;if (crq->adr.tei <64 )@@ -1025,7 +1026,7 @@ create_teimgr(struct manager *mgr, struct channel_req *crq)return 0 ; } l2 =create_l2 (crq->ch, crq->protocol, (u_int )opt, - (u_long )crq->adr.tei); + crq->adr.tei, crq->adr.sapi);if (!l2)return -ENOMEM ; l2->tm =kzalloc (sizeof (struct teimgr ),GFP_KERNEL );@@ -1166,7 +1167,7 @@ static int check_data(struct manager *mgr, struct sk_buff *skb) { struct mISDNhead *hh = mISDN_HEAD_P(skb); -int ret, tei; +int ret, tei, sapi;struct layer2 *l2;if (*debug &DEBUG_L2_CTRL )
drivers/isdn/mISDN/tei.c check_data(struct manager *mgr, struct sk_buff *skb) · line 1182
Quoted 7 lines
drivers/isdn/mISDN/tei.c +1
-3@@ -1178,18 +1179,16 @@ check_data(struct manager *mgr, struct sk_buff *skb)return -ENOTCONN ;if (skb->len !=3 )return -ENOTCONN ; -if (skb->data[0 ] !=0 ) -/* only SAPI 0 command */ -return -ENOTCONN ; + sapi = skb->data[0 ] >>2 ;
PReviously there was an implicit check of EA0.
This is missed not that you read sapi and discard the two lower bits.
I also wonder if you remeber to check the command/response bit. That was implicitly tested to be 0 before and also ignored now.
drivers/isdn/mISDN/tei.c check_data(struct manager *mgr, struct sk_buff *skb) · line 1185
Quoted 4 lines
drivers/isdn/mISDN/tei.c +1
-1if (!(skb->data[1 ] &1 ))/* invalid EA1 */ return -EINVAL ; - tei = skb->data[1 ] >>0 ; + tei = skb->data[1 ] >>1 ;
This looks like a bug-fix...
Quoted 10 lines
drivers/isdn/mISDN/tei.c +1
-1if (tei >63 )/* not a fixed tei */ return -ENOTCONN ;if ((skb->data[2 ] & ~0x10 ) !=SABME )return -ENOTCONN ;/* We got a SABME for a fixed TEI */ - l2 =create_new_tei (mgr, tei); + l2 =create_new_tei (mgr, tei, sapi);if (!l2)return -ENOMEM ; ret = l2->ch.send (&l2->ch, skb);
Re: [mISDN PATCH v2 09/19] Fix TEI and SAPI handling
Hi Sam,
thanks for the review.
Quoted 7 lines · On Freitag, 22. Mai 2009 23:53:14 Sam Ravnborg wrote:
Hi Karsten.
Flash from the past looking at some ISDN layer2.
Some comments below.Sam
Quoted 8 lines
Quoted 4 lines
struct layer2 *
-create_l2(struct mISDNchannel *ch,u_intprotocol,u_longoptions,u_longarg) +create_l2(struct mISDNchannel *ch,u_intprotocol,u_long
options,u_inttei, +u_intsapi)Unrealted to this specific patch...
Are there any specific reason why mISDN prefer bsd style (u_int) rather then linux style (u32)?
No, this was some historic process with the ISDN code.
I think, if we want change this we should make a separate patch to change this in all mISDN code later, I usually prefer shorter type names as well :-). So as rule of dumb:
- Use uN/sN for all values with constant width N ?
What should be used on functions which are usually defined as int and only return 0 or some negative ERROR code, I think int should be OK here ?
Quoted 11 lines
drivers/isdn/mISDN/tei.c tei_ph_data_ind(struct teimgr *tm, u_int mt, u_char *dp, int len) · line 781
Quoted 5 lines
static struct layer2 *
drivers/isdn/mISDN/tei.c +1
-1-create_new_tei(struct manager *mgr, int tei) +create_new_tei(struct manager *mgr, int tei, int sapi) {Here tei and sapi are passed as signed.
But valid sapi range is [0..63] and tei [0..127].
Andcreate_l2above uses unsigned.This looks confusing.
I think the signed was selected for error handling, but you are correct then it should be the same in all functions.
Quoted 16 lines
Quoted 16 lines
drivers/isdn/mISDN/tei.c +1
-1u_long opt =0 ;u_long flags;@@ -791,7 +791,7 @@ create_new_tei(struct manager *mgr, int tei)if (mgr->ch.st->dev->Dprotocols & ((1 <<ISDN_P_TE_E1 ) | (1 <<ISDN_P_NT_E1 )))test_and_set_bit (OPTION_L2_PMX , &opt); - l2 =create_l2 (mgr->up,ISDN_P_LAPD_NT , (u_int )opt, (u_long )tei); + l2 =create_l2 (mgr->up,ISDN_P_LAPD_NT , (u_int )opt, tei, sapi);if (!l2) {printk (KERN_WARNING "%s:no memory for layer2\n" , __func__);return NULL ;@@ -839,12 +839,15 @@ new_tei_req(struct manager *mgr, u_char *dp) ri += dp[1 ];if (!mgr->up) goto denied;
Quoted 9 lines
drivers/isdn/mISDN/tei.c new_tei_req(struct manager *mgr, u_char *dp) · line 845
Quoted 5 lines
drivers/isdn/mISDN/tei.c +4
-1- tei =get_free_tei (mgr); +if (dp[3 ] !=0xff ) + tei = dp[3 ] >>1 ;/* 3GPP TS 08.56 6.1.11.2 */ +else + tei =get_free_tei (mgr);You should check EA0 here before assuming that any values except EA=1, tei=127 equals ptmp.
make sense.
Quoted 9 lines
drivers/isdn/mISDN/tei.c new_tei_req(struct manager *mgr, u_char *dp) · line 849
Quoted 4 lines
drivers/isdn/mISDN/tei.c +0
-0if (tei <0 ) {printk (KERN_WARNING "%s:No free tei\n" , __func__); goto denied; }So
get_free_tei()may return a negative value indicating no free tei. So that make my comment above void - but is this really the best way to return an error. Possibly it is..
We could define 255 as the error value, I will think about this, but in general I prefer negative values for error cases.
Quoted 6 lines
drivers/isdn/mISDN/tei.c new_tei_req(struct manager *mgr, u_char *dp) · line 850
Quoted 2 lines
drivers/isdn/mISDN/tei.c +1
-1- l2 =create_new_tei (mgr, tei); + l2 =create_new_tei (mgr, tei,0 );In general I would prefer to read:
SAPI_CALLCONTROLrahter than a hardcoded 0.
Yes.
Quoted 42 lines
Quoted 31 lines
drivers/isdn/mISDN/tei.c +2
-4if (!l2) goto denied;else @@ -976,8 +979,6 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) __func__, dev_name(&mgr->ch.st->dev->dev), crq->protocol, crq->adr.dev, crq->adr.channel, crq->adr.sapi, crq->adr.tei); -if (crq->adr.sapi !=0 )/* not supported yet */ -return -EINVAL ;if (crq->adr.tei >GROUP_TEI )return -EINVAL ;if (crq->adr.tei <64 )@@ -1025,7 +1026,7 @@ create_teimgr(struct manager *mgr, struct channel_req *crq) return 0; } l2 =create_l2 (crq->ch, crq->protocol, (u_int )opt, - (u_long )crq->adr.tei); + crq->adr.tei, crq->adr.sapi);if (!l2)return -ENOMEM ; l2->tm =kzalloc (sizeof (struct teimgr ),GFP_KERNEL );@@ -1166,7 +1167,7 @@ static int check_data(struct manager *mgr, struct sk_buff *skb) { struct mISDNhead *hh = mISDN_HEAD_P(skb); -int ret, tei; +int ret, tei, sapi;struct layer2 *l2;if (*debug &DEBUG_L2_CTRL )drivers/isdn/mISDN/tei.c check_data(struct manager *mgr, struct sk_buff · line 1182
Quoted 7 lines
drivers/isdn/mISDN/tei.c +1
-3@@ -1178,18 +1179,16 @@ check_data(struct manager *mgr, struct sk_buff *skb) return -ENOTCONN;if (skb->len !=3 )return -ENOTCONN ; -if (skb->data[0 ] !=0 ) -/* only SAPI 0 command */ -return -ENOTCONN ; + sapi = skb->data[0 ] >>2 ;PReviously there was an implicit check of EA0.
This is missed not that you read sapi and discard the two lower bits.
Quoted 2 lines
I also wonder if you remeber to check the command/response bit. That was implicitly tested to be 0 before and also ignored now.
Yes, you are correct.
Quoted 8 lines
drivers/isdn/mISDN/tei.c check_data(struct manager *mgr, struct sk_buff *skb) · line 1185
Quoted 5 lines
drivers/isdn/mISDN/tei.c +1
-1if (!(skb->data[1 ] &1 ))/* invalid EA1 */ return -EINVAL ; - tei = skb->data[1 ] >>0 ; + tei = skb->data[1 ] >>1 ;This looks like a bug-fix...
Yes, I think fixed TEI was never tested with P2MP, I know no device which really use it with SAPI 0, only in P2P we use a fixed TEI of 0. Also the test suite used by certifications did not check for correct fixed TEI handling, it only checks that a fixed TEI is rejected in a dynamic TEI assignment. With SAPI != 0 fixed TEIs are more common, so the bug was detected now.
Quoted 10 lines
Quoted 10 lines
drivers/isdn/mISDN/tei.c +1
-1if (tei >63 )/* not a fixed tei */ return -ENOTCONN ;if ((skb->data[2 ] & ~0x10 ) !=SABME )return -ENOTCONN ;/* We got a SABME for a fixed TEI */ - l2 =create_new_tei (mgr, tei); + l2 =create_new_tei (mgr, tei, sapi);if (!l2)return -ENOMEM ; ret = l2->ch.send (&l2->ch, skb);
Re: [mISDN PATCH v2 09/19] Fix TEI and SAPI handling
Quoted 10 lines
Quoted 4 lines
Unrealted to this specific patch...
Are there any specific reason why mISDN prefer bsd style (u_int) rather then linux style (u32)?No, this was some historic process with the ISDN code.
I think, if we want change this we should make a separate patch to change this in all mISDN code later, I usually prefer shorter type names as well :-). So as rule of dumb:
- Use uN/sN for all values with constant width N ?
yes
Quoted 2 lines
What should be used on functions which are usually defined as int and only return 0 or some negative ERROR code, I think int should be OK here ?
yes - use int here.
Quoted 9 lines
Quoted 9 lines
drivers/isdn/mISDN/tei.c tei_ph_data_ind(struct teimgr *tm, u_int mt, u_char *dp, int len) · line 781
Quoted 4 lines
static struct layer2 *
drivers/isdn/mISDN/tei.c +1
-1-create_new_tei(struct manager *mgr, int tei) +create_new_tei(struct manager *mgr, int tei, int sapi) {Here tei and sapi are passed as signed.
But valid sapi range is [0..63] and tei [0..127].
Andcreate_l2above uses unsigned.
Quoted 4 lines
Quoted 1 line
This looks confusing.
I think the signed was selected for error handling, but you are correct then it should be the same in all functions.
The correct values are the range [0..127] so as you also imply reserving all negative values for error codes seems like the best choice.
So as a matter of consistency you should use int for tei/sapi all over.
Quoted 7 lines
Quoted 5 lines
So
get_free_tei()may return a negative value indicating no free tei. So that make my comment above void - but is this really the best way to return an error. Possibly it is..We could define 255 as the error value, I will think about this, but in general I prefer negative values for error cases.
Addressed above - agree.
Quoted 8 lines
Quoted 7 lines
drivers/isdn/mISDN/tei.c check_data(struct manager *mgr, struct sk_buff *skb) · line 1185
Quoted 4 lines
drivers/isdn/mISDN/tei.c +1
-1if (!(skb->data[1 ] &1 ))/* invalid EA1 */ return -EINVAL ; - tei = skb->data[1 ] >>0 ; + tei = skb->data[1 ] >>1 ;This looks like a bug-fix...
Quoted 7 lines
Yes, I think fixed TEI was never tested with P2MP, I know no device which really use it with SAPI 0, only in P2P we use a fixed TEI of 0. Also the test suite used by certifications did not check for correct fixed TEI handling, it only checks that a fixed TEI is rejected in a dynamic TEI assignment. With SAPI != 0 fixed TEIs are more common, so the bug was detected now.
Yep - I know we used fixed tei in ptmp configuration for sapi=16 (packet handling aka X.25 over ISDN).
Sam
Re: [mISDN PATCH v2 09/19] Fix TEI and SAPI handling
Hi,
new version of this patch:
Subject: [mISDN PATCH v3 09/19] Fix TEI and SAPI handling
From: Karsten Keil <[email protected]>
To: [email protected]
Cc: [email protected],
David Miller <[email protected]>, [email protected]
From: Andreas Eversberg <[email protected]>
Added SAPI value to use SAPIs different than 0.
Now fixed TEIs work in NT mode. This allows PTP endpoint to be connected to PTMP ports together with other PTMP endpoints.
New enhanced version, thanks to Sam Ravnborg <[email protected]> for the hints.
David if you pull from:
"git://master.kernel.org/pub/scm/linux/kernel/git/kkeil/ISDN-2.6-net-next.git for_david"
you get the new version.
drivers/isdn/mISDN/layer2.c +0 -1
@@ -2068,7 +2068,8 @@ l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) } struct layer2 * -create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long
arg)
+create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei,
+ int sapi)
{
struct layer2 *l2;
struct channel_req rq;
@@ -2089,7 +2090,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
test_and_set_bit(FLG_LAPD, &l2->flag); test_and_set_bit(FLG_LAPD_NET, &l2->flag); test_and_set_bit(FLG_MOD128, &l2->flag);
- l2->sapi = 0;
+ l2->sapi = sapi;
l2->maxlen = MAX_DFRAME_LEN;
if (test_bit(OPTION_L2_PMX, &options))
l2->window = 7;
@@ -2099,7 +2100,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
test_and_set_bit(FLG_PTP, &l2->flag);
if (test_bit(OPTION_L2_FIXEDTEI, &options))
test_and_set_bit(FLG_FIXED_TEI, &l2->flag);
- l2->tei = (u_int)arg;
+ l2->tei = tei;
l2->T200 = 1000;
l2->N200 = 3;
l2->T203 = 10000;
@@ -2114,7 +2115,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
test_and_set_bit(FLG_LAPD, &l2->flag); test_and_set_bit(FLG_MOD128, &l2->flag); test_and_set_bit(FLG_ORIG, &l2->flag);
- l2->sapi = 0;
+ l2->sapi = sapi;
l2->maxlen = MAX_DFRAME_LEN;
if (test_bit(OPTION_L2_PMX, &options))
l2->window = 7;
@@ -2124,7 +2125,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
test_and_set_bit(FLG_PTP, &l2->flag);
if (test_bit(OPTION_L2_FIXEDTEI, &options))
test_and_set_bit(FLG_FIXED_TEI, &l2->flag);
- l2->tei = (u_int)arg;
+ l2->tei = tei;
l2->T200 = 1000;
l2->N200 = 3;
l2->T203 = 10000;
@@ -2180,7 +2181,7 @@ x75create(struct channel_req *crq)
if (crq->protocol != ISDN_P_B_X75SLP)
return -EPROTONOSUPPORT;
- l2 = create_l2(crq->ch, crq->protocol, 0, 0);
+ l2 = create_l2(crq->ch, crq->protocol, 0, 0, 0);
if (!l2)
return -ENOMEM;
crq->ch = &l2->ch;
drivers/isdn/mISDN/layer2.h +1 -1
@@ -90,7 +90,7 @@ enum {#define L2_STATE_COUNT (ST_L2_8+1)extern struct layer2 *create_l2 (struct mISDNchannel *,u_int , -u_long ,u_long ); +u_long ,int ,int );extern int tei_l2 (struct layer2 *,u_int ,u_long arg);
drivers/isdn/mISDN/tei.c +1 -1
@@ -426,7 +426,7 @@ done: }static void -put_tei_msg (struct manager *mgr,u_char m_id,unsigned int ri,u_char tei) +put_tei_msg (struct manager *mgr,u_char m_id,unsigned int ri,int tei) {struct sk_buff *skb;u_char bp[8 ];
@@ -440,9 +440,8 @@ put_tei_msg(struct manager *mgr, u_char m_id, unsigned int
ri, u_char tei)
bp[4] = ri >> 8;
bp[5] = ri & 0xff;
bp[6] = m_id;
- bp[7] = (tei << 1) | 1;
- skb = _alloc_mISDN_skb(PH_DATA_REQ, new_id(mgr),
- 8, bp, GFP_ATOMIC);
+ bp[7] = ((tei << 1) & 0xff) | 1;
+ skb = _alloc_mISDN_skb(PH_DATA_REQ, new_id(mgr), 8, bp, GFP_ATOMIC);
if (!skb) {
printk(KERN_WARNING "%s: no skb for tei msg\n", __func__); return;
@@ -777,7 +776,7 @@ tei_ph_data_ind(struct teimgr *tm, u_int mt, u_char *dp, int len)
}
static struct layer2 *
-create_new_tei(struct manager *mgr, int tei) +create_new_tei(struct manager *mgr, int tei, int sapi)
{
u_long opt = 0;
u_long flags;
@@ -786,12 +785,12 @@ create_new_tei(struct manager *mgr, int tei)
if (!mgr->up)
return NULL;
- if (tei < 64)
+ if ((tei >= 0) && (tei < 64))
test_and_set_bit(OPTION_L2_FIXEDTEI, &opt);
if (mgr->ch.st->dev->Dprotocols
& ((1 << ISDN_P_TE_E1) | (1 << ISDN_P_NT_E1)))
test_and_set_bit(OPTION_L2_PMX, &opt);
- l2 = create_l2(mgr->up, ISDN_P_LAPD_NT, (u_int)opt, (u_long)tei);
+ l2 = create_l2(mgr->up, ISDN_P_LAPD_NT, opt, tei, sapi);
if (!l2) {
printk(KERN_WARNING "%s:no memory for layer2\n", __func__); return NULL;
@@ -839,12 +838,17 @@ new_tei_req(struct manager *mgr, u_char *dp)
ri += dp[1];
if (!mgr->up)
goto denied;
- tei = get_free_tei(mgr);
+ if (!(dp[3] & 1)) /* Extension bit != 1 */
+ goto denied;
+ if (dp[3] != 0xff)
+ tei = dp[3] >> 1; /* 3GPP TS 08.56 6.1.11.2 */
+ else
+ tei = get_free_tei(mgr);
if (tei < 0) {
printk(KERN_WARNING "%s:No free tei\n", __func__); goto denied;
}
- l2 = create_new_tei(mgr, tei);
+ l2 = create_new_tei(mgr, tei, CTRL_SAPI);
if (!l2)
goto denied;
else
@@ -976,8 +980,6 @@ create_teimgr(struct manager *mgr, struct channel_req *crq)
__func__, dev_name(&mgr->ch.st->dev->dev), crq->protocol, crq->adr.dev, crq->adr.channel, crq->adr.sapi, crq->adr.tei);
- if (crq->adr.sapi != 0) /* not supported yet */
- return -EINVAL;
if (crq->adr.tei > GROUP_TEI)
return -EINVAL;
if (crq->adr.tei < 64)
@@ -1024,8 +1026,8 @@ create_teimgr(struct manager *mgr, struct channel_req *crq)
}
return 0;
}
- l2 = create_l2(crq->ch, crq->protocol, (u_int)opt,
- (u_long)crq->adr.tei);
+ l2 = create_l2(crq->ch, crq->protocol, opt,
+ crq->adr.tei, crq->adr.sapi);
if (!l2)
return -ENOMEM;
l2->tm = kzalloc(sizeof(struct teimgr), GFP_KERNEL);
@@ -1166,7 +1168,7 @@ static int
check_data(struct manager *mgr, struct sk_buff *skb)
{
struct mISDNhead *hh = mISDN_HEAD_P(skb);
- int ret, tei;
+ int ret, tei, sapi;
struct layer2 *l2;
if (*debug & DEBUG_L2_CTRL)
@@ -1178,18 +1180,18 @@ check_data(struct manager *mgr, struct sk_buff *skb)
return -ENOTCONN;
if (skb->len != 3)
return -ENOTCONN;
- if (skb->data[0] != 0)
- /* only SAPI 0 command */
- return -ENOTCONN;
+ if (skb->data[0] & 3) /* EA0 and CR must be 0 */
+ return -EINVAL;
+ sapi = skb->data[0] >> 2;
if (!(skb->data[1] & 1)) /* invalid EA1 */
return -EINVAL;
- tei = skb->data[1] >> 0;
+ tei = skb->data[1] >> 1;
if (tei > 63) /* not a fixed tei */
return -ENOTCONN;
if ((skb->data[2] & ~0x10) != SABME)
return -ENOTCONN;
/* We got a SABME for a fixed TEI */
- l2 = create_new_tei(mgr, tei);
+ l2 = create_new_tei(mgr, tei, sapi);
if (!l2)
return -ENOMEM;
ret = l2->ch.send(&l2->ch, skb);
Signature · 1 line
1.6.0.2
PATCH v2 10/19 Add "sapi" information to debug messages
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
Using sapi values other than 0 work now.
The "OpenBSC" project does not require special kernel patch anymore.
--- drivers/isdn/mISDN/layer2.c | 24 +++++++++++------------- drivers/isdn/mISDN/tei.c | 11 +++++++++-- 2 files changed, 20 insertions(+), 15 deletions(-)
drivers/isdn/mISDN/layer2.c +11 -13
@@ -99,7 +99,7 @@ l2m_debug(struct FsmInst *fi, char *fmt, ...)if (!(*debug &DEBUG_L2_FSM ))return ;va_start (va, fmt); -printk (KERN_DEBUG "l2 (tei %d): " , l2->tei); +printk (KERN_DEBUG "l2 (sapi %d tei %d): " , l2->sapi, l2->tei);vprintk (fmt, va);printk ("\n" );va_end (va);
@@ -1859,20 +1859,18 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) psapi >>=2 ; ptei >>=1 ;if (psapi != l2->sapi) { -/* not our bussiness -* printk(KERN_DEBUG "%s: sapi %d/%d sapi mismatch\n", -* __func__, -* psapi, l2->sapi); -*/ +/* not our bussiness */ +if (*debug &DEBUG_L2 ) +printk (KERN_DEBUG "%s: sapi %d/%d mismatch\n" , + __func__, psapi, l2->sapi);dev_kfree_skb (skb);return 0 ; }if ((ptei != l2->tei) && (ptei !=GROUP_TEI )) { -/* not our bussiness -* printk(KERN_DEBUG "%s: tei %d/%d sapi %d mismatch\n", -* __func__, -* ptei, l2->tei, psapi); -*/ +/* not our bussiness */ +if (*debug &DEBUG_L2 ) +printk (KERN_DEBUG "%s: tei %d/%d mismatch\n" , + __func__, ptei, l2->tei);dev_kfree_skb (skb);return 0 ; }
@@ -1927,8 +1925,8 @@ l2_send(struct mISDNchannel *ch, struct sk_buff *skb)int ret = -EINVAL ;if (*debug &DEBUG_L2_RECV ) -printk (KERN_DEBUG "%s: prim(%x) id(%x) tei(%d)\n" , - __func__, hh->prim, hh->id, l2->tei); +printk (KERN_DEBUG "%s: prim(%x) id(%x) sapi(%d) tei(%d)\n" , + __func__, hh->prim, hh->id, l2->sapi, l2->tei);switch (hh->prim) {case PH_DATA_IND : ret =ph_data_indication (l2, hh, skb);
drivers/isdn/mISDN/tei.c +9 -2
@@ -227,7 +227,7 @@ tei_debug(struct FsmInst *fi, char *fmt, ...)if (!(*debug &DEBUG_L2_TEIFSM ))return ;va_start (va, fmt); -printk (KERN_DEBUG "tei(%d): " , tm->l2->tei); +printk (KERN_DEBUG "sapi(%d) tei(%d): " , tm->l2->sapi, tm->l2->tei);vprintk (fmt, va);printk ("\n" );va_end (va);
@@ -1188,9 +1188,16 @@ check_data(struct manager *mgr, struct sk_buff *skb)if ((skb->data[2 ] & ~0x10 ) !=SABME )return -ENOTCONN ;/* We got a SABME for a fixed TEI */ +if (*debug &DEBUG_L2_CTRL ) +printk (KERN_DEBUG "%s: SABME sapi(%d) tei(%d)\n" , + __func__, sapi, tei); l2 =create_new_tei (mgr, tei, sapi); -if (!l2) +if (!l2) { +if (*debug &DEBUG_L2_CTRL ) +printk (KERN_DEBUG "%s: failed to create new tei\n" , + __func__);return -ENOMEM ; + } ret = l2->ch.send (&l2->ch, skb);return ret; }
Signature · 1 line
1.6.0.2
PATCH v2 11/19 Add allocation of recvbuf[1500] at run time to reduce stack size
In reply to Karsten KeilFrom: Frank Seidel <[email protected]>
Before: 1656 bytes on i386, now 164.
Modified by Andreas Eversberg <[email protected]>
--- drivers/isdn/mISDN/l1oip_core.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-)
drivers/isdn/mISDN/l1oip_core.c +17 -4
@@ -663,18 +663,28 @@ l1oip_socket_thread(void *data)struct iovec iov;mm_segment_t oldfs;struct sockaddr_in sin_rx; -unsigned char recvbuf[1500 ]; +unsigned char *recvbuf; +size_t recvbuf_size =1500 ;int recvlen;struct socket *socket =NULL ;DECLARE_COMPLETION (wait); +/* allocate buffer memory */ + recvbuf =kmalloc (recvbuf_size,GFP_KERNEL ); +if (!recvbuf) { +printk (KERN_ERR "%s: Failed to alloc recvbuf.\n" , __func__); + ret = -ENOMEM ; + goto fail; + } +/* make daemon */ allow_signal (SIGTERM );/* create socket */ if (sock_create (PF_INET ,SOCK_DGRAM ,IPPROTO_UDP , &socket)) {printk (KERN_ERR "%s: Failed to create socket.\n" , __func__); -return -EIO ; + ret = -EIO ; + goto fail; }/* set incoming address */
@@ -730,10 +740,10 @@ l1oip_socket_thread(void *data) __func__);while (!signal_pending (current)) { iov.iov_base = recvbuf; - iov.iov_len =sizeof (recvbuf); + iov.iov_len = recvbuf_size; oldfs =get_fs ();set_fs (KERNEL_DS ); - recvlen =sock_recvmsg (socket, &msg,sizeof (recvbuf),0 ); + recvlen =sock_recvmsg (socket, &msg, recvbuf_size,0 );set_fs (oldfs);if (recvlen >0 ) {l1oip_socket_parse (hc, &sin_rx, recvbuf, recvlen);
@@ -760,6 +770,9 @@ l1oip_socket_thread(void *data) __func__); fail: +/* free recvbuf */ +kfree (recvbuf); +/* close socket */ if (socket)sock_release (socket);
Signature · 1 line
1.6.0.2
PATCH v2 12/19 Fix skb leak in error cases
In reply to Karsten KeilIf the channel receive function returns an error the skb must be freed.
--- drivers/isdn/mISDN/socket.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-)
drivers/isdn/mISDN/socket.c +12 -10
@@ -209,7 +209,7 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock,if (memcpy_fromiovec (skb_put (skb, len), msg->msg_iov, len)) { err = -EFAULT ; - goto drop; + goto done; }memcpy (mISDN_HEAD_P (skb), skb->data,MISDN_HEADER_LEN );
@@ -230,19 +230,21 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, __func__, mISDN_HEAD_ID(skb)); err = -ENODEV ; -if (!_pms (sk)->ch.peer || - (err =_pms (sk)->ch.recv (_pms (sk)->ch.peer, skb))) - goto drop; - - err = len; +if (!_pms (sk)->ch.peer) + goto done; + err =_pms (sk)->ch.recv (_pms (sk)->ch.peer, skb); +if (err) + goto done; +else { + skb =NULL ; + err = len; + } done: +if (skb) +kfree_skb (skb);release_sock (sk);return err; - -drop: -kfree_skb (skb); - goto done; } static int
Signature · 1 line
1.6.0.2
PATCH v2 13/19 isdn: get_free_devid() failure ignored
In reply to Karsten KeilFrom: Roel Kluin <[email protected]>
dev->id is unsigned so a get_free_devid() error is ignored.
--- drivers/isdn/mISDN/core.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/isdn/mISDN/core.c +4 -4
@@ -214,7 +214,7 @@ get_free_devid(void)if (!test_and_set_bit (i, (u_long *)&device_ids))break ;if (i >MAX_DEVICE_ID ) -return -1 ; +return -EBUSY ;return i; }
@@ -224,10 +224,10 @@ mISDN_register_device(struct mISDNdevice *dev, {int err; - dev->id =get_free_devid (); - err = -EBUSY ; -if (dev->id <0 ) + err =get_free_devid (); +if (err <0 ) goto error1; + dev->id = err;device_initialize (&dev->dev);if (name && name[0 ])
Signature · 1 line
1.6.0.2
PATCH v2 14/19 Add XHFC support for embedded Speech-Design board to hfcmulti
In reply to Karsten KeilNew version without emulating arch specific stuff for the other architectures, the special IO and init functions for the 8xx microcontroller are in a separate include file.
--- drivers/isdn/hardware/mISDN/Kconfig | 11 +- drivers/isdn/hardware/mISDN/hfc_multi.h | 45 +++- drivers/isdn/hardware/mISDN/hfc_multi_8xx.h | 167 +++++++++++ drivers/isdn/hardware/mISDN/hfcmulti.c | 416 ++++++++++++++++++--------- drivers/isdn/mISDN/dsp_cmx.c | 4 + include/linux/mISDNdsp.h | 1 + 6 files changed, 500 insertions(+), 144 deletions(-) create mode 100644 drivers/isdn/hardware/mISDN/hfc_multi_8xx.h
drivers/isdn/hardware/mISDN/Kconfig +10 -1
@@ -13,7 +13,7 @@ config MISDN_HFCPCI config MISDN_HFCMULTI tristate "Support for HFC multiport cards (HFC-4S/8S/E1)" - depends on PCI + depends on PCI || 8xx depends on MISDN help Enable support for cards with Cologne Chip AG's HFC multiport
@@ -23,6 +23,15 @@ config MISDN_HFCMULTI * HFC-8S (8 S/T interfaces on one chip) * HFC-E1 (E1 interface for 2Mbit ISDN) +config MISDN_HFCMULTI_8xx + boolean "Support for XHFC embedded board in HFC multiport driver" + depends on MISDN + depends on MISDN_HFCMULTI + depends on 8xx + default 8xx + help + Enable support for the XHFC embedded solution from Speech Design. + config MISDN_HFCUSB tristate "Support for HFC-S USB based TAs" depends on USB
drivers/isdn/hardware/mISDN/hfc_multi.h +35 -10
89 lines not on this page · raw message
drivers/isdn/hardware/mISDN/hfc_multi_8xx.h new file +167 -0
167 lines not on this page · raw message
drivers/isdn/hardware/mISDN/hfcmulti.c +283 -133
876 lines not on this page · raw message
drivers/isdn/mISDN/dsp_cmx.c +4 -0
@@ -947,6 +947,10 @@ conf_software:if (current_conf >=0 ) { join_members:list_for_each_entry (member, &conf->mlist, list) { +/* if no conference engine on our chip, change to +* software */ +if (!member->dsp->features.hfc_conf) + goto conf_software;/* in case of hdlc, change to software */ if (member->dsp->hdlc) goto conf_software;
include/linux/mISDNdsp.h +1 -0
@@ -25,6 +25,7 @@ extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem);struct dsp_features {int hfc_id;/* unique id to identify the chip (or -1) */ int hfc_dtmf;/* set if HFCmulti card supports dtmf */ +int hfc_conf;/* set if HFCmulti card supports conferences */ int hfc_loops;/* set if card supports tone loops */ int hfc_echocanhw;/* set if card supports echocancelation*/ int pcm_id;/* unique id to identify the pcm bus (or -1) */
Signature · 1 line
1.6.0.2
PATCH v2 15/19 Add PCI ID for Junghanns 8S card
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
new id for HFC-8S
--- drivers/isdn/hardware/mISDN/hfcmulti.c | 3 +++ include/linux/pci_ids.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/isdn/hardware/mISDN/hfcmulti.c +3 -0
@@ -5275,6 +5275,7 @@ static const struct hm_map hfcm_map[] = { /*30*/ {VENDOR_CCD, "HFC-8S OpenVox", 8, 8, 1, 0, 0, 0, 0, 0}, /*31*/ {VENDOR_CCD, "XHFC-4S Speech Design", 5, 4, 0, 0, 0, 0, HFC_IO_MODE_EMBSD, XHFC_IRQ}, +/*32*/ {VENDOR_JH, "HFC-8S (junghanns)", 8, 8, 1, 0, 0, 0, 0, 0}, };#undef H
@@ -5328,6 +5329,8 @@ static struct pci_device_id hfmultipci_ids[] __devinitdata = { PCI_SUBDEVICE_ID_CCD_HFC8S, 0, 0, H(18)}, /* 8S */ { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC8S, PCI_VENDOR_ID_CCD, PCI_SUBDEVICE_ID_CCD_OV8S, 0, 0, H(30)}, /* OpenVox 8 */ + { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC8S, PCI_VENDOR_ID_CCD, + PCI_SUBDEVICE_ID_CCD_JH8S, 0, 0, H(32)}, /* Junganns 8S */ /* Cards with HFC-E1 Chip */
include/linux/pci_ids.h +1 -0
@@ -1914,6 +1914,7 @@#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 +#define PCI_SUBDEVICE_ID_CCD_JH8S 0xB55B#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563
Signature · 1 line
1.6.0.2
PATCH v2 16/19 Added PCI ID for new Junghanns.net Single E1 cards.
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
The new ID is validated by Cologne Chip.
LEDs control is also supported.
--- drivers/isdn/hardware/mISDN/hfcmulti.c | 4 ++++ include/linux/pci_ids.h | 1 + 2 files changed, 5 insertions(+), 0 deletions(-)
drivers/isdn/hardware/mISDN/hfcmulti.c +4 -0
@@ -5354,6 +5354,10 @@ static struct pci_device_id hfmultipci_ids[] __devinitdata = { PCI_SUBDEVICE_ID_CCD_SPD4S, 0, 0, H(26)}, /* PLX PCI Bridge */ { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030, PCI_VENDOR_ID_CCD, PCI_SUBDEVICE_ID_CCD_SPDE1, 0, 0, H(27)}, /* PLX PCI Bridge */ + + { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFCE1, PCI_VENDOR_ID_CCD, + PCI_SUBDEVICE_ID_CCD_JHSE1, 0, 0, H(25)}, /* Junghanns E1 */ + { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC4S, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC8S, PCI_ANY_ID, PCI_ANY_ID,
include/linux/pci_ids.h +1 -0
@@ -1914,6 +1914,7 @@#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 +#define PCI_SUBDEVICE_ID_CCD_JHSE1 0xB553#define PCI_SUBDEVICE_ID_CCD_JH8S 0xB55B#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562
Signature · 1 line
1.6.0.2
PATCH v2 17/19 Cleanup debug messages
In reply to Karsten KeilThis patch make debug printk's KERN_DEBUG and also fix some codestyle issues.
--- drivers/isdn/hardware/mISDN/hfcmulti.c | 159 ++++++++++++++++---------------- drivers/isdn/hardware/mISDN/hfcpci.c | 28 +++--- drivers/isdn/mISDN/dsp_audio.c | 5 +- drivers/isdn/mISDN/dsp_cmx.c | 7 +- drivers/isdn/mISDN/dsp_core.c | 14 ++-- drivers/isdn/mISDN/dsp_ecdis.h | 2 +- drivers/isdn/mISDN/dsp_tones.c | 23 +++-- drivers/isdn/mISDN/l1oip_core.c | 30 +++--- drivers/isdn/mISDN/socket.c | 2 +- drivers/isdn/mISDN/tei.c | 1 - drivers/isdn/mISDN/timerdev.c | 2 +- include/linux/mISDNif.h | 14 ++-- 12 files changed, 148 insertions(+), 139 deletions(-)
drivers/isdn/hardware/mISDN/hfcmulti.c +81 -78
@@ -275,7 +275,7 @@ HFC_outb_pcimem(struct hfc_multi *hc, u_char reg, u_char val, HFC_outb_pcimem(struct hfc_multi *hc, u_char reg, u_char val) #endif { - writeb(val, (hc->pci_membase)+reg); + writeb(val, hc->pci_membase + reg); } static u_char#ifdef HFC_REGISTER_DEBUG
@@ -284,7 +284,7 @@ HFC_inb_pcimem(struct hfc_multi *hc, u_char reg, const char *function, int line) HFC_inb_pcimem(struct hfc_multi *hc, u_char reg)#endif { -return readb ((hc->pci_membase)+reg); +return readb (hc->pci_membase + reg); }static u_short #ifdef HFC_REGISTER_DEBUG
@@ -293,7 +293,7 @@ HFC_inw_pcimem(struct hfc_multi *hc, u_char reg, const char *function, int line) HFC_inw_pcimem(struct hfc_multi *hc, u_char reg)#endif { -return readw ((hc->pci_membase)+reg); +return readw (hc->pci_membase + reg); }static void #ifdef HFC_REGISTER_DEBUG
@@ -302,7 +302,8 @@ HFC_wait_pcimem(struct hfc_multi *hc, const char *function, int line) HFC_wait_pcimem(struct hfc_multi *hc)#endif { -while (readb ((hc->pci_membase)+R_STATUS ) &V_BUSY ); +while (readb (hc->pci_membase +R_STATUS ) &V_BUSY ) +cpu_relax (); }/* HFC_IO_MODE_REGIO */
@@ -314,7 +315,7 @@ HFC_outb_regio(struct hfc_multi *hc, u_char reg, u_char val, HFC_outb_regio(struct hfc_multi *hc, u_char reg, u_char val) #endif { - outb(reg, (hc->pci_iobase)+4); + outb(reg, hc->pci_iobase + 4);outb (val, hc->pci_iobase); } static u_char
@@ -324,7 +325,7 @@ HFC_inb_regio(struct hfc_multi *hc, u_char reg, const char *function, int line) HFC_inb_regio(struct hfc_multi *hc, u_char reg)#endif { -outb (reg, (hc->pci_iobase)+4 ); +outb (reg, hc->pci_iobase +4 );return inb (hc->pci_iobase); } static u_short
@@ -334,7 +335,7 @@ HFC_inw_regio(struct hfc_multi *hc, u_char reg, const char *function, int line) HFC_inw_regio(struct hfc_multi *hc, u_char reg)#endif { -outb (reg, (hc->pci_iobase)+4 ); +outb (reg, hc->pci_iobase +4 );return inw (hc->pci_iobase); } static void
@@ -344,8 +345,9 @@ HFC_wait_regio(struct hfc_multi *hc, const char *function, int line) HFC_wait_regio(struct hfc_multi *hc)#endif { -outb (R_STATUS , (hc->pci_iobase)+4 ); -while (inb (hc->pci_iobase) &V_BUSY ); +outb (R_STATUS , hc->pci_iobase +4 ); +while (inb (hc->pci_iobase) &V_BUSY ) +cpu_relax (); }#ifdef HFC_REGISTER_DEBUG
@@ -364,14 +366,14 @@ HFC_outb_debug(struct hfc_multi *hc, u_char reg, u_char val,if (regname[0 ] =='\0' )strcpy (regname,"register" ); - bits[7 ] ='0' +(!!(val&1 )); - bits[6 ] ='0' +(!!(val&2 )); - bits[5 ] ='0' +(!!(val&4 )); - bits[4 ] ='0' +(!!(val&8 )); - bits[3 ] ='0' +(!!(val&16 )); - bits[2 ] ='0' +(!!(val&32 )); - bits[1 ] ='0' +(!!(val&64 )); - bits[0 ] ='0' +(!!(val&128 )); + bits[7 ] ='0' + (!!(val &1 )); + bits[6 ] ='0' + (!!(val &2 )); + bits[5 ] ='0' + (!!(val &4 )); + bits[4 ] ='0' + (!!(val &8 )); + bits[3 ] ='0' + (!!(val &16 )); + bits[2 ] ='0' + (!!(val &32 )); + bits[1 ] ='0' + (!!(val &64 )); + bits[0 ] ='0' + (!!(val &128 ));printk (KERN_DEBUG "HFC_outb(chip %d, %02x=%s, 0x%02x=%s); in %s() line %d\n" , hc->id, reg, regname, val, bits, function, line);
@@ -394,14 +396,14 @@ HFC_inb_debug(struct hfc_multi *hc, u_char reg, const char *function, int line)if (regname[0 ] =='\0' )strcpy (regname,"register" ); - bits[7 ] ='0' +(!!(val&1 )); - bits[6 ] ='0' +(!!(val&2 )); - bits[5 ] ='0' +(!!(val&4 )); - bits[4 ] ='0' +(!!(val&8 )); - bits[3 ] ='0' +(!!(val&16 )); - bits[2 ] ='0' +(!!(val&32 )); - bits[1 ] ='0' +(!!(val&64 )); - bits[0 ] ='0' +(!!(val&128 )); + bits[7 ] ='0' + (!!(val &1 )); + bits[6 ] ='0' + (!!(val &2 )); + bits[5 ] ='0' + (!!(val &4 )); + bits[4 ] ='0' + (!!(val &8 )); + bits[3 ] ='0' + (!!(val &16 )); + bits[2 ] ='0' + (!!(val &32 )); + bits[1 ] ='0' + (!!(val &64 )); + bits[0 ] ='0' + (!!(val &128 ));printk (KERN_DEBUG "HFC_inb(chip %d, %02x=%s) = 0x%02x=%s; in %s() line %d\n" , hc->id, reg, regname, val, bits, function, line);
@@ -481,6 +483,7 @@ write_fifo_pcimem(struct hfc_multi *hc, u_char *data, int len) len--; } } +/* read fifo data (REGIO) */ static void read_fifo_regio (struct hfc_multi *hc,u_char *data,int len)
@@ -526,7 +529,6 @@ read_fifo_pcimem(struct hfc_multi *hc, u_char *data, int len) } } -static void enable_hwirq (struct hfc_multi *hc) {
@@ -1011,7 +1013,7 @@ plxsd_checksync(struct hfc_multi *hc, int rm)if (hc->syncronized) {if (syncmaster ==NULL ) {if (debug &DEBUG_HFCMULTI_PLXSD ) -printk (KERN_WARNING "%s: GOT sync on card %d" +printk (KERN_DEBUG "%s: GOT sync on card %d" " (id=%d)\n" , __func__, hc->id +1 , hc->id);hfcmulti_resync (hc, hc, rm);
@@ -1019,7 +1021,7 @@ plxsd_checksync(struct hfc_multi *hc, int rm) }else {if (syncmaster == hc) {if (debug &DEBUG_HFCMULTI_PLXSD ) -printk (KERN_WARNING "%s: LOST sync on card %d" +printk (KERN_DEBUG "%s: LOST sync on card %d" " (id=%d)\n" , __func__, hc->id +1 , hc->id);hfcmulti_resync (hc,NULL , rm);
@@ -1068,7 +1070,7 @@ release_io_hfcmulti(struct hfc_multi *hc) pv &= ~PLX_DSP_RES_N ;writel (pv, plx_acc_32);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: PCM off: PLX_GPIO=%x\n" , +printk (KERN_DEBUG "%s: PCM off: PLX_GPIO=%x\n" , __func__, pv);spin_unlock_irqrestore (&plx_lock, plx_flags); }
@@ -1119,8 +1121,8 @@ init_chip(struct hfc_multi *hc)if (debug &DEBUG_HFCMULTI_INIT )printk (KERN_DEBUG "%s: entered\n" , __func__); val =HFC_inb (hc,R_CHIP_ID ); -if ((val>>4 ) !=0x8 && (val>>4 ) !=0xc && (val>>4 ) !=0xe - && (val>>1 ) !=0x31 ) { +if ((val >>4 ) !=0x8 && (val >>4 ) !=0xc && (val >>4 ) !=0xe && + (val >>1 ) !=0x31 ) {printk (KERN_INFO "HFC_multi: unknown CHIP_ID:%x\n" , (u_int )val); err = -EIO ; goto out;
@@ -1202,7 +1204,7 @@ init_chip(struct hfc_multi *hc)writel (pv, plx_acc_32);spin_unlock_irqrestore (&plx_lock, plx_flags);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: slave/term: PLX_GPIO=%x\n" , +printk (KERN_DEBUG "%s: slave/term: PLX_GPIO=%x\n" , __func__, pv);/* * If we are the 3rd PLXSD card or higher, we must turn
@@ -1230,8 +1232,9 @@ init_chip(struct hfc_multi *hc)writel (pv, plx_acc_32);spin_unlock_irqrestore (&plx_lock, plx_flags);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: term off: PLX_GPIO=%x\n" , - __func__, pv); +printk (KERN_DEBUG +"%s: term off: PLX_GPIO=%x\n" , + __func__, pv); }spin_unlock_irqrestore (&HFClock, hfc_flags); hc->hw.r_pcm_md0 =V_F0_LEN ;/* shift clock for DSP */
@@ -1292,13 +1295,13 @@ init_chip(struct hfc_multi *hc) pv |=PLX_MASTER_EN |PLX_SLAVE_EN_N ; pv |=PLX_SYNC_O_EN ;if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: master: PLX_GPIO=%x\n" , +printk (KERN_DEBUG "%s: master: PLX_GPIO=%x\n" , __func__, pv); }else { pv &= ~(PLX_MASTER_EN |PLX_SLAVE_EN_N ); pv &= ~PLX_SYNC_O_EN ;if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: slave: PLX_GPIO=%x\n" , +printk (KERN_DEBUG "%s: slave: PLX_GPIO=%x\n" , __func__, pv); }writel (pv, plx_acc_32);
@@ -1410,8 +1413,8 @@ controller_fail:writel (pv, plx_acc_32);spin_unlock_irqrestore (&plx_lock, plx_flags);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: master: PLX_GPIO" -"=%x\n" , __func__, pv); +printk (KERN_DEBUG "%s: master: " +"PLX_GPIO=%x\n" , __func__, pv); } hc->hw.r_pcm_md0 |=V_PCM_MD ;HFC_outb (hc,R_PCM_MD0 , hc->hw.r_pcm_md0 |0x00 );
@@ -1445,7 +1448,7 @@ controller_fail:writel (pv, plx_acc_32);spin_unlock_irqrestore (&plx_lock, plx_flags);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: reset off: PLX_GPIO=%x\n" , +printk (KERN_DEBUG "%s: reset off: PLX_GPIO=%x\n" , __func__, pv); }
@@ -1878,7 +1881,7 @@ hfcmulti_dtmf(struct hfc_multi *hc) hc->chan[ch].coeff_count =0 ; skb =mI_alloc_skb (512 ,GFP_ATOMIC );if (!skb) { -printk (KERN_WARNING "%s: No memory for skb\n" , +printk (KERN_DEBUG "%s: No memory for skb\n" , __func__);continue ; }
@@ -2104,7 +2107,7 @@ next_frame:printk (KERN_DEBUG "%s(card %d): fifo(%d) has %d bytes space " "left (z1=%04x, z2=%04x) sending %d of %d bytes %s\n" , __func__, hc->id +1 , ch, Zspace, z1, z2, ii-i, len-i, - temp ?"HDLC" :"TRANS" ); + temp ?"HDLC" :"TRANS" );/* Have to prep the audio data */ hc->write_fifo (hc, d, ii - i);
@@ -2780,13 +2783,13 @@ hfcmulti_interrupt(int intno, void *dev_id)handle_timer_irq (hc); } -if (r_irq_misc &V_DTMF_IRQ ) { +if (r_irq_misc &V_DTMF_IRQ )hfcmulti_dtmf (hc); - } +if (r_irq_misc &V_IRQ_PROC ) {static int irq_proc_cnt;if (!irq_proc_cnt++) -printk (KERN_WARNING "%s: got V_IRQ_PROC -" +printk (KERN_DEBUG "%s: got V_IRQ_PROC -" " this should not happen\n" , __func__); }
@@ -2936,7 +2939,7 @@ mode_hfcmulti(struct hfc_multi *hc, int ch, int protocol, int slot_tx,else flow_rx =0xc0 ;/* ST->(FIFO,PCM) */ /* put on slot */ - routing = bank_rx?0x80 :0xc0 ;/* reversed */ + routing = bank_rx ?0x80 :0xc0 ;/* reversed */ if (conf >=0 || bank_rx >1 ) routing =0x40 ;/* loop */ if (debug &DEBUG_HFCMULTI_MODE )
@@ -2971,7 +2974,7 @@ mode_hfcmulti(struct hfc_multi *hc, int ch, int protocol, int slot_tx,HFC_wait (hc);if (hc->chan[ch].bch && hc->ctype !=HFC_TYPE_E1 ) { hc->hw.a_st_ctrl0[hc->chan[ch].port] &= - ((ch &0x3 ) ==0 )? ~V_B1_EN : ~V_B2_EN ; + ((ch &0x3 ) ==0 ) ? ~V_B1_EN : ~V_B2_EN ;HFC_outb (hc,R_ST_SEL , hc->chan[ch].port);/* undocumented: delay after R_ST_SEL */ udelay (1 );
@@ -3505,9 +3508,9 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb)switch (hh->id) {case HFC_SPL_LOOP_ON :/* set sample loop */ if (debug &DEBUG_HFCMULTI_MSG ) -printk (KERN_DEBUG -"%s: HFC_SPL_LOOP_ON (len = %d)\n" , - __func__, skb->len); +printk (KERN_DEBUG +"%s: HFC_SPL_LOOP_ON (len = %d)\n" , + __func__, skb->len); ret =0 ;break ;case HFC_SPL_LOOP_OFF :/* set silence */
@@ -3716,8 +3719,7 @@ ph_state_change(struct dchannel *dch)int ch, i;if (!dch) { -printk (KERN_WARNING "%s: ERROR given dch is NULL\n" , - __func__); +printk (KERN_WARNING "%s: ERROR given dch is NULL\n" , __func__);return ; } hc = dch->hw;
@@ -3738,14 +3740,15 @@ ph_state_change(struct dchannel *dch)switch (dch->state) {case (1 ):if (hc->e1_state !=1 ) { -for (i =1 ; i <=31 ; i++) { -/* reset fifos on e1 activation */ -HFC_outb_nodebug (hc,R_FIFO , (i <<1 ) |1 ); -HFC_wait_nodebug (hc); -HFC_outb_nodebug (hc, -R_INC_RES_FIFO ,V_RES_F ); -HFC_wait_nodebug (hc); - } +for (i =1 ; i <=31 ; i++) { +/* reset fifos on e1 activation */ +HFC_outb_nodebug (hc,R_FIFO , + (i <<1 ) |1 ); +HFC_wait_nodebug (hc); +HFC_outb_nodebug (hc,R_INC_RES_FIFO , +V_RES_F ); +HFC_wait_nodebug (hc); + } }test_and_set_bit (FLG_ACTIVE , &dch->Flags); _queue_data(&dch->dev.D, PH_ACTIVATE_IND,
@@ -4045,12 +4048,12 @@ open_dchannel(struct hfc_multi *hc, struct dchannel *dch,return -EINVAL ;if ((dch->dev.D.protocol !=ISDN_P_NONE ) && (dch->dev.D.protocol != rq->protocol)) { -if (debug &DEBUG_HFCMULTI_MODE ) -printk (KERN_WARNING "%s: change protocol %x to %x\n" , - __func__, dch->dev.D.protocol, rq->protocol); +if (debug &DEBUG_HFCMULTI_MODE ) +printk (KERN_DEBUG "%s: change protocol %x to %x\n" , + __func__, dch->dev.D.protocol, rq->protocol); } -if ((dch->dev.D.protocol ==ISDN_P_TE_S0 ) - && (rq->protocol !=ISDN_P_TE_S0 )) +if ((dch->dev.D.protocol ==ISDN_P_TE_S0 ) && + (rq->protocol !=ISDN_P_TE_S0 ))l1_event (dch->l1,CLOSE_CHANNEL );if (dch->dev.D.protocol != rq->protocol) {if (rq->protocol ==ISDN_P_TE_S0 ) {
@@ -4127,9 +4130,9 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq) wd_cnt = cq->p1 &0xf ; wd_mode = !!(cq->p1 >>4 );if (debug &DEBUG_HFCMULTI_MSG ) -printk (KERN_DEBUG -"%s: MISDN_CTRL_HFC_WD_INIT mode %s counter 0x%x\n" , - __func__, wd_mode ?"AUTO" :"MANUAL" , wd_cnt); +printk (KERN_DEBUG "%s: MISDN_CTRL_HFC_WD_INIT mode %s" +", counter 0x%x\n" , __func__, + wd_mode ?"AUTO" :"MANUAL" , wd_cnt);/* set the watchdog timer */ HFC_outb (hc,R_TI_WD , poll_timer | (wd_cnt <<4 )); hc->hw.r_bert_wd_md = (wd_mode ?V_AUTO_WD_RES :0 );
@@ -4139,8 +4142,8 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)HFC_outb (hc,R_BERT_WD_MD , hc->hw.r_bert_wd_md |V_WD_RES );if (test_bit (HFC_CHIP_PLXSD , &hc->chip)) {/* enable the watchdog output for Speech-Design */ -HFC_outb (hc,R_GPIO_SEL ,V_GPIO_SEL7 ); -HFC_outb (hc,R_GPIO_EN1 ,V_GPIO_EN15 ); +HFC_outb (hc,R_GPIO_SEL ,V_GPIO_SEL7 ); +HFC_outb (hc,R_GPIO_EN1 ,V_GPIO_EN15 );HFC_outb (hc,R_GPIO_OUT1 ,0 );HFC_outb (hc,R_GPIO_OUT1 ,V_GPIO_OUT15 ); }
@@ -4319,7 +4322,7 @@ error: }if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: free irq %d\n" , __func__, hc->irq); +printk (KERN_DEBUG "%s: free irq %d\n" , __func__, hc->irq);if (hc->irq) {free_irq (hc->irq, hc); hc->irq =0 ;
@@ -4624,7 +4627,7 @@ release_card(struct hfc_multi *hc)int ch;if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: release card (%d) entered\n" , +printk (KERN_DEBUG "%s: release card (%d) entered\n" , __func__, hc->id);/* unregister clock source */
@@ -4653,7 +4656,7 @@ release_card(struct hfc_multi *hc)/* release hardware & irq */ if (hc->irq) {if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: free irq %d\n" , +printk (KERN_DEBUG "%s: free irq %d\n" , __func__, hc->irq);free_irq (hc->irq, hc); hc->irq =0 ;
@@ -4662,17 +4665,17 @@ release_card(struct hfc_multi *hc)release_io_hfcmulti (hc);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: remove instance from list\n" , +printk (KERN_DEBUG "%s: remove instance from list\n" , __func__);list_del (&hc->list);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: delete instance\n" , __func__); +printk (KERN_DEBUG "%s: delete instance\n" , __func__);if (hc == syncmaster) syncmaster =NULL ;kfree (hc);if (debug &DEBUG_HFCMULTI_INIT ) -printk (KERN_WARNING "%s: card successfully removed\n" , +printk (KERN_DEBUG "%s: card successfully removed\n" , __func__); }
@@ -4695,7 +4698,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m) (1 << (ISDN_P_B_HDLC &ISDN_P_B_MASK )); dch->dev.D.send = handle_dmsg; dch->dev.D.ctrl = hfcm_dctrl; - dch->dev.nrbchan = (hc->dslot)?30 :31 ; + dch->dev.nrbchan = (hc->dslot) ?30 :31 ; dch->slot = hc->dslot; hc->chan[hc->dslot].dch = dch; hc->chan[hc->dslot].port =0 ;
@@ -4937,7 +4940,7 @@ init_multi_port(struct hfc_multi *hc, int pt) }/* disable E-channel */ if (port[Port_cnt] &0x004 ) { -if (debug &DEBUG_HFCMULTI_INIT ) +if (debug &DEBUG_HFCMULTI_INIT ) printk(KERN_DEBUG "%s: PROTOCOL disable E-channel: " "card(%d) port(%d)\n",
@@ -5222,7 +5225,7 @@ static void __devexit hfc_remove_pci(struct pci_dev *pdev)spin_unlock_irqrestore (&HFClock, flags); }else {if (debug) -printk (KERN_WARNING "%s: drvdata allready removed\n" , +printk (KERN_DEBUG "%s: drvdata allready removed\n" , __func__); } }
drivers/isdn/hardware/mISDN/hfcpci.c +15 -13
@@ -257,7 +257,7 @@ reset_hfcpci(struct hfc_pci *hc)Write_hfc (hc,HFCPCI_INT_M1 , hc->hw.int_m1);/* Clear already pending ints */ -if (Read_hfc (hc,HFCPCI_INT_S1 )); + val =Read_hfc (hc,HFCPCI_INT_S1 );/* set NT/TE mode */ hfcpci_setmode (hc);
@@ -499,7 +499,8 @@ receive_dmsg(struct hfc_pci *hc) df->f2 = ((df->f2 +1 ) &MAX_D_FRAMES ) | (MAX_D_FRAMES +1 );/* next buffer */ df->za[df->f2 &D_FREG_MASK ].z2 = -cpu_to_le16 ((le16_to_cpu (zp->z2) + rcnt) & (D_FIFO_SIZE -1 )); +cpu_to_le16 ((le16_to_cpu (zp->z2) + rcnt) & + (D_FIFO_SIZE -1 )); }else { dch->rx_skb =mI_alloc_skb (rcnt -3 ,GFP_ATOMIC );if (!dch->rx_skb) {
@@ -966,6 +967,7 @@ static void ph_state_nt(struct dchannel *dch) {struct hfc_pci *hc = dch->hw; +u_char val;if (dch->debug) printk(KERN_DEBUG "%s: NT newstate %x\n",
@@ -979,7 +981,7 @@ ph_state_nt(struct dchannel *dch) hc->hw.int_m1 &= ~HFCPCI_INTS_TIMER ;Write_hfc (hc,HFCPCI_INT_M1 , hc->hw.int_m1);/* Clear already pending ints */ -if (Read_hfc (hc,HFCPCI_INT_S1 )); + val =Read_hfc (hc,HFCPCI_INT_S1 );Write_hfc (hc,HFCPCI_STATES ,4 |HFCPCI_LOAD_STATE );udelay (10 );Write_hfc (hc,HFCPCI_STATES ,4 );
@@ -1268,8 +1270,7 @@ mode_hfcpci(struct bchannel *bch, int bc, int protocol) rx_slot = (bc>>8 ) &0xff ; tx_slot = (bc>>16 ) &0xff ; bc = bc &0xff ; - }else if (test_bit (HFC_CFG_PCM , &hc->cfg) && - (protocol >ISDN_P_NONE )) + }else if (test_bit (HFC_CFG_PCM , &hc->cfg) && (protocol >ISDN_P_NONE ))printk (KERN_WARNING "%s: no pcm channel id but HFC_CFG_PCM\n" , __func__);if (hc->chanlimit >1 ) {
@@ -1327,8 +1328,8 @@ mode_hfcpci(struct bchannel *bch, int bc, int protocol)case (ISDN_P_B_RAW ): bch->state = protocol; bch->nr = bc; -hfcpci_clear_fifo_rx (hc, (fifo2 &2 )?1 :0 ); -hfcpci_clear_fifo_tx (hc, (fifo2 &2 )?1 :0 ); +hfcpci_clear_fifo_rx (hc, (fifo2 &2 ) ?1 :0 ); +hfcpci_clear_fifo_tx (hc, (fifo2 &2 ) ?1 :0 );if (bc &2 ) { hc->hw.sctrl |=SCTRL_B2_ENA ; hc->hw.sctrl_r |=SCTRL_B2_ENA ;
@@ -1362,8 +1363,8 @@ mode_hfcpci(struct bchannel *bch, int bc, int protocol)case (ISDN_P_B_HDLC ): bch->state = protocol; bch->nr = bc; -hfcpci_clear_fifo_rx (hc, (fifo2 &2 )?1 :0 ); -hfcpci_clear_fifo_tx (hc, (fifo2 &2 )?1 :0 ); +hfcpci_clear_fifo_rx (hc, (fifo2 &2 ) ?1 :0 ); +hfcpci_clear_fifo_tx (hc, (fifo2 &2 ) ?1 :0 );if (bc &2 ) { hc->hw.sctrl |=SCTRL_B2_ENA ; hc->hw.sctrl_r |=SCTRL_B2_ENA ;
@@ -1457,7 +1458,7 @@ set_hfcpci_rxtest(struct bchannel *bch, int protocol, int chan)switch (protocol) {case (ISDN_P_B_RAW ): bch->state = protocol; -hfcpci_clear_fifo_rx (hc, (chan &2 )?1 :0 ); +hfcpci_clear_fifo_rx (hc, (chan &2 ) ?1 :0 );if (chan &2 ) { hc->hw.sctrl_r |=SCTRL_B2_ENA ; hc->hw.fifo_en |=HFCPCI_FIFOEN_B2RX ;
@@ -1482,7 +1483,7 @@ set_hfcpci_rxtest(struct bchannel *bch, int protocol, int chan)break ;case (ISDN_P_B_HDLC ): bch->state = protocol; -hfcpci_clear_fifo_rx (hc, (chan &2 )?1 :0 ); +hfcpci_clear_fifo_rx (hc, (chan &2 ) ?1 :0 );if (chan &2 ) { hc->hw.sctrl_r |=SCTRL_B2_ENA ; hc->hw.last_bfifo_cnt[1 ] =0 ;
@@ -2047,7 +2048,8 @@ setup_hw(struct hfc_pci *hc)printk (KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n" );return 1 ; } - hc->hw.pci_io = (char __iomem *)(unsigned long )hc->pdev->resource[1 ].start; + hc->hw.pci_io = + (char __iomem *)(unsigned long )hc->pdev->resource[1 ].start;if (!hc->hw.pci_io) {printk (KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n" );
@@ -2289,7 +2291,7 @@ hfc_remove_pci(struct pci_dev *pdev)release_card (card); else if (debug) - printk(KERN_WARNING "%s: drvdata already removed\n", + printk(KERN_DEBUG "%s: drvdata already removed\n", __func__); }
drivers/isdn/mISDN/dsp_audio.c +2 -3
@@ -210,9 +210,8 @@ dsp_audio_generate_seven(void) j =0 ;for (k =0 ; k <256 ; k++) {if (dsp_audio_alaw_to_s32[k] - < dsp_audio_alaw_to_s32[i]) { - j++; - } + < dsp_audio_alaw_to_s32[i]) + j++; } sorted_alaw[j] = i; }
drivers/isdn/mISDN/dsp_cmx.c +4 -3
@@ -238,7 +238,7 @@ dsp_cmx_add_conf_member(struct dsp *dsp, struct dsp_conf *conf) member =kzalloc (sizeof (struct dsp_conf_member ),GFP_ATOMIC );if (!member) { -printk (KERN_ERR "kmalloc struct dsp_conf_member failed\n" ); +printk (KERN_ERR "kzalloc struct dsp_conf_member failed\n" );return -ENOMEM ; } member->dsp = dsp;
@@ -317,7 +317,7 @@ static struct dsp_conf conf =kzalloc (sizeof (struct dsp_conf ),GFP_ATOMIC );if (!conf) { -printk (KERN_ERR "kmalloc struct dsp_conf failed\n" ); +printk (KERN_ERR "kzalloc struct dsp_conf failed\n" );return NULL ; }INIT_LIST_HEAD (&conf->mlist);
@@ -1389,7 +1389,8 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members)while (r != rr && t != tt) {#ifdef CMX_TX_DEBUG if (strlen (debugbuf) <48 ) -sprintf (debugbuf+strlen (debugbuf)," %02x" , p[t]); +sprintf (debugbuf+strlen (debugbuf)," %02x" , + p[t]);#endif *d++ = p[t];/* write tx_buff */ t = (t+1 ) &CMX_BUFF_MASK ;
drivers/isdn/mISDN/dsp_core.c +7 -7
@@ -280,7 +280,7 @@ dsp_fill_empty(struct dsp *dsp)static int dsp_control_req (struct dsp *dsp,struct mISDNhead *hh,struct sk_buff *skb) { -struct sk_buff *nskb; +struct sk_buff *nskb;int ret =0 ;int cont;u8 *data;
@@ -558,7 +558,7 @@ tone_off: dsp->pipeline.inuse =1 ;dsp_cmx_hardware (dsp->conf, dsp); ret =dsp_pipeline_build (&dsp->pipeline, - len >0 ? (char *)data :NULL ); + len >0 ? data :NULL );dsp_cmx_hardware (dsp->conf, dsp);dsp_rx_off (dsp); }
@@ -720,7 +720,7 @@ dsp_function(struct mISDNchannel *ch, struct sk_buff *skb)/* check if dtmf soft decoding is turned on */ if (dsp->dtmf.software) { digits =dsp_dtmf_goertzel_decode (dsp, skb->data, - skb->len, (dsp_options&DSP_OPT_ULAW )?1 :0 ); + skb->len, (dsp_options&DSP_OPT_ULAW ) ?1 :0 ); }/* we need to process receive data if software */ if (dsp->conf && dsp->conf->software) {
@@ -952,7 +952,7 @@ dsp_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg)int err =0 ;if (debug &DEBUG_DSP_CTRL ) -printk (KERN_DEBUG "%s:(%x)\n" , __func__, cmd); +printk (KERN_DEBUG "%s:(%x)\n" , __func__, cmd);switch (cmd) {case OPEN_CHANNEL :
@@ -1175,9 +1175,9 @@ static int dsp_init(void)/* init conversion tables */ dsp_audio_generate_law_tables (); - dsp_silence = (dsp_options&DSP_OPT_ULAW )?0xff :0x2a ; - dsp_audio_law_to_s32 = (dsp_options&DSP_OPT_ULAW )?dsp_audio_ulaw_to_s32: - dsp_audio_alaw_to_s32; + dsp_silence = (dsp_options&DSP_OPT_ULAW ) ?0xff :0x2a ; + dsp_audio_law_to_s32 = (dsp_options&DSP_OPT_ULAW ) ? + dsp_audio_ulaw_to_s32 : dsp_audio_alaw_to_s32;dsp_audio_generate_s2law_table ();dsp_audio_generate_seven ();dsp_audio_generate_mix_table ();
drivers/isdn/mISDN/dsp_ecdis.h +1 -1
@@ -91,7 +91,7 @@ int16_t amp) && det->tone_cycle_duration <= 475*8) { det->good_cycles++;if (det->good_cycles >2 ) - det->hit = TRUE; + det->hit = TRUE; } det->tone_cycle_duration =0 ; }
drivers/isdn/mISDN/dsp_tones.c +14 -9
@@ -253,18 +253,24 @@ static struct pattern { {8000, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, {TONE_GERMAN_DIALPBX, - {DATA_GA, DATA_S, DATA_GA, DATA_S, DATA_GA, DATA_S, NULL, NULL, NULL, NULL}, - {SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, NULL, NULL, NULL, NULL}, + {DATA_GA, DATA_S, DATA_GA, DATA_S, DATA_GA, DATA_S, NULL, NULL, NULL, + NULL}, + {SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, SIZE_GA, SIZE_S, NULL, NULL, NULL, + NULL}, {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, {TONE_GERMAN_OLDDIALPBX, - {DATA_GO, DATA_S, DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, NULL}, - {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, NULL}, + {DATA_GO, DATA_S, DATA_GO, DATA_S, DATA_GO, DATA_S, NULL, NULL, NULL, + NULL}, + {SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, SIZE_GO, SIZE_S, NULL, NULL, NULL, + NULL}, {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, {TONE_AMERICAN_DIALPBX, - {DATA_DT, DATA_S, DATA_DT, DATA_S, DATA_DT, DATA_S, NULL, NULL, NULL, NULL}, - {SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, NULL, NULL, NULL, NULL}, + {DATA_DT, DATA_S, DATA_DT, DATA_S, DATA_DT, DATA_S, NULL, NULL, NULL, + NULL}, + {SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, SIZE_DT, SIZE_S, NULL, NULL, NULL, + NULL}, {2000, 2000, 2000, 2000, 2000, 12000, 0, 0, 0, 0} }, {TONE_GERMAN_RINGING,
@@ -434,7 +440,7 @@ dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len)/* unlocking is not required, because we don't expect a response */ nskb =_alloc_mISDN_skb (PH_CONTROL_REQ , - (len)?HFC_SPL_LOOP_ON :HFC_SPL_LOOP_OFF , len, sample, + (len) ?HFC_SPL_LOOP_ON :HFC_SPL_LOOP_OFF , len, sample,GFP_ATOMIC );if (nskb) {if (dsp->ch.peer) {
@@ -498,8 +504,7 @@ dsp_tone(struct dsp *dsp, int tone)/* we turn off the tone */ if (!tone) { -if (dsp->features.hfc_loops) -if (timer_pending (&tonet->tl)) +if (dsp->features.hfc_loops &&timer_pending (&tonet->tl))del_timer (&tonet->tl);if (dsp->features.hfc_loops)dsp_tone_hw_message (dsp,NULL ,0 );
drivers/isdn/mISDN/l1oip_core.c +15 -15
@@ -308,8 +308,8 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask,/* assemble frame */ *p++ = (L1OIP_VERSION <<6 )/* version and coding */ - | (hc->pri?0x20 :0x00 )/* type */ - | (hc->id?0x10 :0x00 )/* id */ + | (hc->pri ?0x20 :0x00 )/* type */ + | (hc->id ?0x10 :0x00 )/* id */ | localcodec;if (hc->id) { *p++ = hc->id>>24 ;/* id */
@@ -317,7 +317,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, *p++ = hc->id>>8 ; *p++ = hc->id; } - *p++ = (multi ==1 )?0x80 :0x00 + channel;/* m-flag, channel */ + *p++ = (multi ==1 ) ?0x80 :0x00 + channel;/* m-flag, channel */ if (multi ==1 ) *p++ = len;/* length */ *p++ = timebase>>8 ;/* time base */
@@ -401,12 +401,12 @@ l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, }/* prepare message */ - nskb =mI_alloc_skb ((remotecodec ==3 )?(len<<1 ):len,GFP_ATOMIC ); + nskb =mI_alloc_skb ((remotecodec ==3 ) ? (len<<1 ) : len,GFP_ATOMIC );if (!nskb) {printk (KERN_ERR "%s: No mem for skb.\n" , __func__);return ; } - p =skb_put (nskb, (remotecodec ==3 )?(len<<1 ):len); + p =skb_put (nskb, (remotecodec ==3 ) ? (len<<1 ) : len);if (remotecodec ==1 && ulaw)l1oip_alaw_to_ulaw (buf, len, p);
@@ -458,7 +458,7 @@ l1oip_socket_recv(struct l1oip *hc, u8 remotecodec, u8 channel, u16 timebase, hc->chan[channel].disorder_flag ^=1 ; if (nskb)#endif -queue_ch_frame (&bch->ch,PH_DATA_IND , rx_counter, nskb); +queue_ch_frame (&bch->ch,PH_DATA_IND , rx_counter, nskb); } }
@@ -749,8 +749,8 @@ l1oip_socket_thread(void *data)l1oip_socket_parse (hc, &sin_rx, recvbuf, recvlen); }else {if (debug &DEBUG_L1OIP_SOCKET ) -printk (KERN_WARNING "%s: broken pipe on socket\n" , - __func__); +printk (KERN_WARNING +"%s: broken pipe on socket\n" , __func__); } }
@@ -925,7 +925,7 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb) p = skb->data; l = skb->len;while (l) { - ll = (l <L1OIP_MAX_PERFRAME )?l:L1OIP_MAX_PERFRAME ; + ll = (l <L1OIP_MAX_PERFRAME ) ? l :L1OIP_MAX_PERFRAME ;l1oip_socket_send (hc,0 , dch->slot,0 , hc->chan[dch->slot].tx_counter++, p, ll); p += ll;
@@ -1173,7 +1173,7 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) p = skb->data; l = skb->len;while (l) { - ll = (l <L1OIP_MAX_PERFRAME )?l:L1OIP_MAX_PERFRAME ; + ll = (l <L1OIP_MAX_PERFRAME ) ? l :L1OIP_MAX_PERFRAME ;l1oip_socket_send (hc, hc->codec, bch->slot,0 , hc->chan[bch->slot].tx_counter, p, ll); hc->chan[bch->slot].tx_counter += ll;
@@ -1331,8 +1331,8 @@ init_card(struct l1oip *hc, int pri, int bundle)spin_lock_init (&hc->socket_lock); hc->idx = l1oip_cnt; hc->pri = pri; - hc->d_idx = pri?16 :3 ; - hc->b_num = pri?30 :2 ; + hc->d_idx = pri ?16 :3 ; + hc->b_num = pri ?30 :2 ; hc->bundle = bundle;if (hc->pri)sprintf (hc->name,"l1oip-e1.%d" , l1oip_cnt +1 );
@@ -1517,9 +1517,9 @@ l1oip_init(void)if (debug &DEBUG_L1OIP_INIT )printk (KERN_DEBUG "%s: interface %d is %s with %s.\n" , - __func__, l1oip_cnt, pri?"PRI" :"BRI" , - bundle?"bundled IP packet for all B-channels" - :"seperate IP packets for every B-channel" ); + __func__, l1oip_cnt, pri ?"PRI" :"BRI" , + bundle ?"bundled IP packet for all B-channels" : +"seperate IP packets for every B-channel" ); hc =kzalloc (sizeof (struct l1oip ),GFP_ATOMIC );if (!hc) {
drivers/isdn/mISDN/socket.c +1 -1
@@ -222,7 +222,7 @@ mISDN_sock_sendmsg(struct kiocb *iocb, struct socket *sock, }else {/* use default for L2 messages */ if ((sk->sk_protocol ==ISDN_P_LAPD_TE ) || (sk->sk_protocol ==ISDN_P_LAPD_NT )) -mISDN_HEAD_ID (skb) =_pms (sk)->ch.nr; +mISDN_HEAD_ID (skb) =_pms (sk)->ch.nr; }if (*debug &DEBUG_SOCKET )
drivers/isdn/mISDN/tei.c +0 -1
@@ -871,7 +871,6 @@ ph_data_ind(struct manager *mgr, struct sk_buff *skb) __func__, skb->len); goto done; } -if (*debug &DEBUG_L2_TEI )if ((skb->data[0 ] >>2 ) !=TEI_SAPI )/* not for us */ goto done;
drivers/isdn/mISDN/timerdev.c +1 -1
@@ -259,7 +259,7 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,return ret; } -static struct file_operations mISDN_fops = { +static const struct file_operations mISDN_fops = { .read = mISDN_read, .poll = mISDN_poll, .ioctl = mISDN_ioctl,
include/linux/mISDNif.h +7 -7
@@ -292,19 +292,19 @@ struct mISDN_devrename {/* MPH_INFORMATION_REQ payload */ struct ph_info_ch { -__u32 protocol; -__u64 Flags; +__u32 protocol; +__u64 Flags; };struct ph_info_dch { -struct ph_info_ch ch; -__u16 state; -__u16 num_bch; +struct ph_info_ch ch; +__u16 state; +__u16 num_bch; };struct ph_info { -struct ph_info_dch dch; -struct ph_info_ch bch[]; +struct ph_info_dch dch; +struct ph_info_ch bch[]; };/* timer device ioctl */
Signature · 1 line
1.6.0.2
PATCH v2 18/19 Use kernel_{send,recv}msg instead of open coding
In reply to Karsten KeilFrom: Arnaldo Carvalho de Melo <[email protected]>
Reducing the number of direct users of sock_{recv,send}msg. Modified version to match the latest context.
--- drivers/isdn/mISDN/l1oip.h | 2 +- drivers/isdn/mISDN/l1oip_core.c | 24 +++++++----------------- 2 files changed, 8 insertions(+), 18 deletions(-)
drivers/isdn/mISDN/l1oip.h +1 -1
@@ -76,7 +76,7 @@ struct l1oip {struct sockaddr_in sin_local;/* local socket name */ struct sockaddr_in sin_remote;/* remote socket name */ struct msghdr sendmsg;/* ip message to send */ -struct iovec sendiov;/* iov for message */ +struct kvec sendiov;/* iov for message */ /* frame */ struct l1oip_chan chan[128 ];/* channel instances */
drivers/isdn/mISDN/l1oip_core.c +7 -17
@@ -279,7 +279,6 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask,int multi =0 ;u8 frame[len+32 ];struct socket *socket =NULL ; -mm_segment_t oldfs;if (debug &DEBUG_L1OIP_MSG ) printk(KERN_DEBUG "%s: sending data to socket (len = %d)\n",
@@ -352,10 +351,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, "= %d)\n", __func__, len); hc->sendiov.iov_base = frame; hc->sendiov.iov_len = len; - oldfs =get_fs (); -set_fs (KERNEL_DS ); - len =sock_sendmsg (socket, &hc->sendmsg, len); -set_fs (oldfs); + len =kernel_sendmsg (socket, &hc->sendmsg, &hc->sendiov,1 , len);/* give socket back */ hc->socket = socket;/* no locking required */
@@ -660,8 +656,6 @@ l1oip_socket_thread(void *data)struct l1oip *hc = (struct l1oip *)data;int ret =0 ;struct msghdr msg; -struct iovec iov; -mm_segment_t oldfs;struct sockaddr_in sin_rx;unsigned char *recvbuf;size_t recvbuf_size =1500 ;
@@ -718,16 +712,12 @@ l1oip_socket_thread(void *data) msg.msg_namelen =sizeof (sin_rx); msg.msg_control =NULL ; msg.msg_controllen =0 ; - msg.msg_iov = &iov; - msg.msg_iovlen =1 ;/* build send message */ hc->sendmsg.msg_name = &hc->sin_remote; hc->sendmsg.msg_namelen =sizeof (hc->sin_remote); hc->sendmsg.msg_control =NULL ; hc->sendmsg.msg_controllen =0 ; - hc->sendmsg.msg_iov = &hc->sendiov; - hc->sendmsg.msg_iovlen =1 ;/* give away socket */ spin_lock (&hc->socket_lock);
@@ -739,12 +729,12 @@ l1oip_socket_thread(void *data)printk (KERN_DEBUG "%s: socket created and open\n" , __func__);while (!signal_pending (current)) { - iov.iov_base = recvbuf; - iov.iov_len = recvbuf_size; - oldfs =get_fs (); -set_fs (KERNEL_DS ); - recvlen =sock_recvmsg (socket, &msg, recvbuf_size,0 ); -set_fs (oldfs); +struct kvec iov = { + .iov_base = recvbuf, + .iov_len =sizeof (recvbuf), + }; + recvlen =kernel_recvmsg (socket, &msg, &iov,1 , +sizeof (recvbuf),0 );if (recvlen >0 ) {l1oip_socket_parse (hc, &sin_rx, recvbuf, recvlen); }else {
Signature · 1 line
1.6.0.2
PATCH v2 19/19 Fix DTMF detection enable/disable
In reply to Karsten KeilFrom: Andreas Eversberg <[email protected]>
DTMF detection was enabled when it was not supposed to.
--- drivers/isdn/mISDN/dsp.h | 1 + drivers/isdn/mISDN/dsp_core.c | 2 ++ drivers/isdn/mISDN/dsp_dtmf.c | 3 +++ 3 files changed, 6 insertions(+), 0 deletions(-)
drivers/isdn/mISDN/dsp.h +1 -0
@@ -116,6 +116,7 @@ struct dsp_conf {#define ECHOCAN_BUFF_MASK 0x3ff/* -1 */ struct dsp_dtmf { +int enable;/* dtmf is enabled */ int treshold;/* above this is dtmf (square of) */ int software;/* dtmf uses software decoding */ int hardware;/* dtmf uses hardware decoding */
drivers/isdn/mISDN/dsp_core.c +2 -0
@@ -306,6 +306,7 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb) "to %d\n", *((int *)data)); dsp->dtmf.treshold = (*(int *)data) *10000 ; } + dsp->dtmf.enable =1 ;/* init goertzel */ dsp_dtmf_goertzel_init (dsp);
@@ -316,6 +317,7 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb)case DTMF_TONE_STOP :/* turn off DTMF */ if (dsp_debug &DEBUG_DSP_CORE )printk (KERN_DEBUG "%s: stop dtmf\n" , __func__); + dsp->dtmf.enable =0 ; dsp->dtmf.hardware =0 ; dsp->dtmf.software =0 ;break ;
drivers/isdn/mISDN/dsp_dtmf.c +3 -0
@@ -51,6 +51,9 @@ void dsp_dtmf_hardware(struct dsp *dsp) {int hardware =1 ; +if (!dsp->dtmf.enable) +return ; +if (!dsp->features.hfc_dtmf) hardware =0 ;
Signature · 1 line
1.6.0.2
David Miller
maintainerFrom: Karsten Keil <[email protected]>
Date: Fri, 22 May 2009 22:42:47 +0200
Quoted 10 lines
This is a update of the mISDN driver for net-next.
It syncs the mISDN driver with the development on git.misdn.org. More updates (new hardware support) will follow.You can pull it from
git://master.kernel.org/pub/scm/linux/kernel/git/kkeil/ISDN-2.6-net-next.gitfor_daveAndreas Eversberg (12):
Add watchdog functionality to hfcmulti driver
DSP now uses ring buffer for echo canceler
There is no way I'm pulling from that tree, even with the fixed up patch #9.
How in the world is anyone supposed to know these are mISDN changes by looking at those changlog header lines? They say nothing about the subsystem they are in.
I've modified every commit log message so that it says:
mISDN: foo bar baz
instead of the anonymous stuff above.