fix hang on B-channel 2

This commit is contained in:
Karsten Keil 2001-03-05 01:48:27 +00:00
parent e129521a3b
commit 7518a0e6ec
4 changed files with 11 additions and 13 deletions

View File

@ -238,6 +238,7 @@ capi20_manager(void *data, u_int prim, void *arg) {
inst = &binst->inst; inst = &binst->inst;
break; break;
} }
binst = binst->next;
} }
if (inst) if (inst)
break; break;

View File

@ -49,7 +49,6 @@ struct isar_reg {
struct isar_hw { struct isar_hw {
int dpath; int dpath;
int txcnt;
int mml; int mml;
u_char state; u_char state;
u_char cmd; u_char cmd;
@ -68,7 +67,6 @@ struct hdlc_hw {
struct hdlc_stat_reg sr; struct hdlc_stat_reg sr;
} ctrl; } ctrl;
u_int stat; u_int stat;
int count; /* Current skb sent count */
}; };

View File

@ -704,7 +704,7 @@ isar_fill_fifo(bchannel_t *bch)
u_char *ptr; u_char *ptr;
if ((bch->debug & L1_DEB_HSCX) && !(bch->debug & L1_DEB_HSCX_FIFO)) if ((bch->debug & L1_DEB_HSCX) && !(bch->debug & L1_DEB_HSCX_FIFO))
debugprint(&bch->inst, "isar_fill_fifo"); debugprint(&bch->inst, __FUNCTION__);
count = bch->tx_len - bch->tx_idx; count = bch->tx_len - bch->tx_idx;
if (count <= 0) if (count <= 0)
return; return;
@ -718,8 +718,7 @@ isar_fill_fifo(bchannel_t *bch)
msb = HDLC_FED; msb = HDLC_FED;
} }
ptr = bch->tx_buf + bch->tx_idx; ptr = bch->tx_buf + bch->tx_idx;
bch->tx_idx += count; if (!bch->tx_idx) {
if (!bch->hw.isar.txcnt) {
msb |= HDLC_FST; msb |= HDLC_FST;
if ((bch->protocol == ISDN_PID_L1_B_FAX) && if ((bch->protocol == ISDN_PID_L1_B_FAX) &&
(bch->hw.isar.cmd == PCTRL_CMD_FTH)) { (bch->hw.isar.cmd == PCTRL_CMD_FTH)) {
@ -731,10 +730,10 @@ isar_fill_fifo(bchannel_t *bch)
} }
} }
} }
bch->hw.isar.txcnt += count; bch->tx_idx += count;
switch (bch->protocol) { switch (bch->protocol) {
case ISDN_PID_NONE: case ISDN_PID_NONE:
printk(KERN_ERR"isar_fill_fifo wrong protocol 0\n"); printk(KERN_ERR __FUNCTION__" wrong protocol 0\n");
break; break;
case ISDN_PID_L1_B_64TRANS: case ISDN_PID_L1_B_64TRANS:
case ISDN_PID_L1_B_TRANS_TTR: case ISDN_PID_L1_B_TRANS_TTR:
@ -750,7 +749,7 @@ isar_fill_fifo(bchannel_t *bch)
case ISDN_PID_L1_B_FAX: case ISDN_PID_L1_B_FAX:
if (bch->hw.isar.state != STFAX_ACTIV) { if (bch->hw.isar.state != STFAX_ACTIV) {
if (bch->debug & L1_DEB_WARN) if (bch->debug & L1_DEB_WARN)
debugprint(&bch->inst, "isar_fill_fifo: not ACTIV"); debugprint(&bch->inst, __FUNCTION__": not ACTIV");
} else if (bch->hw.isar.cmd == PCTRL_CMD_FTH) { } else if (bch->hw.isar.cmd == PCTRL_CMD_FTH) {
sendmsg(bch, SET_DPS(bch->hw.isar.dpath) | ISAR_HIS_SDATA, sendmsg(bch, SET_DPS(bch->hw.isar.dpath) | ISAR_HIS_SDATA,
msb, count, ptr); msb, count, ptr);
@ -759,13 +758,13 @@ isar_fill_fifo(bchannel_t *bch)
0, count, ptr); 0, count, ptr);
} else { } else {
if (bch->debug & L1_DEB_WARN) if (bch->debug & L1_DEB_WARN)
debugprint(&bch->inst, "isar_fill_fifo: not FTH/FTM"); debugprint(&bch->inst, __FUNCTION__": not FTH/FTM");
} }
break; break;
default: default:
if (bch->debug) if (bch->debug)
debugprint(&bch->inst, "isar_fill_fifo protocol(%x) error", bch->protocol); debugprint(&bch->inst, __FUNCTION__": protocol(%x) error", bch->protocol);
printk(KERN_ERR"isar_fill_fifo protocol(%x) error\n", bch->protocol); printk(KERN_ERR __FUNCTION__" protocol(%x) error\n", bch->protocol);
break; break;
} }
} }
@ -788,6 +787,7 @@ send_frames(bchannel_t *bch)
if (bch->tx_len - bch->tx_idx) { if (bch->tx_len - bch->tx_idx) {
isar_fill_fifo(bch); isar_fill_fifo(bch);
} else { } else {
bch->tx_idx = 0;
if (bch->protocol == ISDN_PID_L1_B_FAX) { if (bch->protocol == ISDN_PID_L1_B_FAX) {
if (bch->hw.isar.cmd == PCTRL_CMD_FTH) { if (bch->hw.isar.cmd == PCTRL_CMD_FTH) {
if (test_bit(BC_FLG_LASTDATA, &bch->Flag)) { if (test_bit(BC_FLG_LASTDATA, &bch->Flag)) {
@ -800,13 +800,11 @@ send_frames(bchannel_t *bch)
} }
} }
} }
bch->hw.isar.txcnt = 0;
if (test_and_clear_bit(FLG_TX_NEXT, &bch->Flag)) { if (test_and_clear_bit(FLG_TX_NEXT, &bch->Flag)) {
if (bch->next_skb) { if (bch->next_skb) {
bch->tx_len = bch->next_skb->len; bch->tx_len = bch->next_skb->len;
memcpy(bch->tx_buf, memcpy(bch->tx_buf,
bch->next_skb->data, bch->tx_len); bch->next_skb->data, bch->tx_len);
bch->tx_idx = 0;
isar_fill_fifo(bch); isar_fill_fifo(bch);
isar_sched_event(bch, B_XMTBUFREADY); isar_sched_event(bch, B_XMTBUFREADY);
} else { } else {

View File

@ -876,6 +876,7 @@ Speedfax_init(void)
sprintf(card->dch.inst.id, "SFax%d", sedl_cnt+1); sprintf(card->dch.inst.id, "SFax%d", sedl_cnt+1);
init_dchannel(&card->dch); init_dchannel(&card->dch);
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
card->bch[i].channel = i;
card->bch[i].inst.obj = &speedfax; card->bch[i].inst.obj = &speedfax;
card->bch[i].inst.data = card; card->bch[i].inst.data = card;
card->bch[i].inst.layermask = 0; card->bch[i].inst.layermask = 0;