Commit b688af83 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Unified xmit_complete_b()

Again, this code sequence is repeated in a lot of drivers, so 
separate it out.
parent 3e2cc616
......@@ -453,8 +453,7 @@ HDLC_irq(struct BCState *bcs, u_int stat) {
hdlc_fill_fifo(bcs);
return;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
bcs->hw.hdlc.count = 0;
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
......@@ -1906,8 +1906,7 @@ static void hisax_b_l1l2(struct hisax_if *ifc, int pr, void *arg)
case PH_DATA | CONFIRM:
skb = arg;
bcs->tx_cnt -= skb->truesize;
skb_queue_tail(&bcs->cmpl_queue, skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
skb = skb_dequeue(&bcs->squeue);
if (skb) {
B_L2L1(b_if, PH_DATA | REQUEST, skb);
......
......@@ -564,8 +564,7 @@ Memhscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx)
Memhscx_fill_fifo(bcs);
return;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
bcs->hw.hscx.count = 0;
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
......@@ -300,8 +300,7 @@ modem_fill(struct BCState *bcs) {
write_modem(bcs);
return;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
bcs->hw.hscx.count = 0;
......
......@@ -360,9 +360,7 @@ hfc_fill_fifo(struct BCState *bcs)
printk(KERN_WARNING "HFC S FIFO channel %d BUSY Error\n", bcs->channel);
} else {
bcs->tx_cnt -= bcs->tx_skb->len;
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
bcs->tx_skb = NULL;
xmit_complete_b(bcs);
}
WaitForBusy(cs);
cli();
......
......@@ -315,9 +315,7 @@ hfc_fill_fifo(struct BCState *bcs)
if (PACKET_NOACK == bcs->tx_skb->pkt_type)
count = -1;
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
bcs->tx_skb = NULL;
xmit_complete_b(bcs);
if (bcs->mode != L1_MODE_TRANS) {
WaitForBusy(cs);
WaitNoBusy(cs);
......
......@@ -732,15 +732,13 @@ hfcpci_fill_fifo(struct BCState *bcs)
memcpy(dst, src, count);
}
bcs->tx_cnt -= bcs->tx_skb->len;
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
cli();
bz->za[new_f1].z1 = cpu_to_le16(new_z1); /* for next buffer */
bz->f1 = new_f1; /* next frame */
restore_flags(flags);
bcs->tx_skb = NULL;
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
return;
}
......
......@@ -591,11 +591,9 @@ hfcsx_fill_fifo(struct BCState *bcs)
(bcs->mode == L1_MODE_TRANS) ?
HFCSX_BTRANS_THRESHOLD : 0)) {
bcs->tx_cnt -= bcs->tx_skb->len;
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
bcs->tx_skb = NULL;
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
bcs->tx_cnt -= bcs->tx_skb->len;
xmit_complete_b(bcs);
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
}
cli();
......
......@@ -1413,3 +1413,11 @@ sched_b_event(struct BCState *bcs, int event)
set_bit(event, &bcs->event);
schedule_work(&bcs->work);
}
static inline void
xmit_complete_b(struct BCState *bcs)
{
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
bcs->tx_skb = NULL;
}
......@@ -207,8 +207,7 @@ hscx_interrupt(struct IsdnCardState *cs, u_char val, u_char hscx)
__hscx_fill_fifo(bcs);
return;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
bcs->hw.hscx.count = 0;
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
......@@ -750,8 +750,7 @@ bch_int(struct IsdnCardState *cs, u_char hscx)
bch_fill_fifo(bcs);
goto afterXPR;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
bcs->hw.hscx.count = 0;
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
......@@ -750,8 +750,7 @@ send_frames(struct BCState *bcs)
isar_fill_fifo(bcs);
return;
} else {
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
if (bcs->mode == L1_MODE_FAX) {
if (bcs->hw.isar.cmd == PCTRL_CMD_FTH) {
if (test_bit(BC_FLG_LASTDATA, &bcs->Flag)) {
......@@ -765,7 +764,6 @@ send_frames(struct BCState *bcs)
}
}
bcs->hw.isar.txcnt = 0;
bcs->tx_skb = NULL;
}
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
......@@ -186,8 +186,7 @@ jade_interrupt(struct IsdnCardState *cs, u_char val, u_char jade)
jade_fill_fifo(bcs);
return;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
bcs->hw.hscx.count = 0;
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
......@@ -759,9 +759,7 @@ static void write_raw(struct BCState *bcs, u_int *buf, int cnt) {
if (!bcs->tx_skb) {
debugl1(bcs->cs,"tiger write_raw: NULL skb s_cnt %d", s_cnt);
} else {
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
bcs->tx_skb = NULL;
xmit_complete_b(bcs);
}
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
bcs->hw.tiger.free = cnt - s_cnt;
......
......@@ -360,8 +360,7 @@ W6692B_interrupt(struct IsdnCardState *cs, u_char bchan)
W6692B_fill_fifo(bcs);
return;
}
skb_queue_tail(&bcs->cmpl_queue, bcs->tx_skb);
sched_b_event(bcs, B_CMPLREADY);
xmit_complete_b(bcs);
bcs->hw.w6692.count = 0;
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment