aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/mISDN/netjet.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hardware/mISDN/netjet.c')
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c79
1 files changed, 34 insertions, 45 deletions
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index da13b07cd856..3f28057e725e 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -386,24 +386,16 @@ read_dma(struct tiger_ch *bc, u32 idx, int cnt)
386 bc->bch.nr, idx); 386 bc->bch.nr, idx);
387 } 387 }
388 bc->lastrx = idx; 388 bc->lastrx = idx;
389 if (!bc->bch.rx_skb) { 389 stat = bchannel_get_rxbuf(&bc->bch, cnt);
390 bc->bch.rx_skb = mI_alloc_skb(bc->bch.maxlen, GFP_ATOMIC); 390 /* only transparent use the count here, HDLC overun is detected later */
391 if (!bc->bch.rx_skb) { 391 if (stat == ENOMEM) {
392 pr_info("%s: B%1d receive out of memory\n", 392 pr_warning("%s.B%d: No memory for %d bytes\n",
393 card->name, bc->bch.nr); 393 card->name, bc->bch.nr, cnt);
394 return; 394 return;
395 }
396 } 395 }
397 396 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags))
398 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) {
399 if ((bc->bch.rx_skb->len + cnt) > bc->bch.maxlen) {
400 pr_debug("%s: B%1d overrun %d\n", card->name,
401 bc->bch.nr, bc->bch.rx_skb->len + cnt);
402 skb_trim(bc->bch.rx_skb, 0);
403 return;
404 }
405 p = skb_put(bc->bch.rx_skb, cnt); 397 p = skb_put(bc->bch.rx_skb, cnt);
406 } else 398 else
407 p = bc->hrbuf; 399 p = bc->hrbuf;
408 400
409 for (i = 0; i < cnt; i++) { 401 for (i = 0; i < cnt; i++) {
@@ -414,48 +406,45 @@ read_dma(struct tiger_ch *bc, u32 idx, int cnt)
414 idx = 0; 406 idx = 0;
415 p[i] = val & 0xff; 407 p[i] = val & 0xff;
416 } 408 }
409
410 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) {
411 recv_Bchannel(&bc->bch, 0);
412 return;
413 }
414
417 pn = bc->hrbuf; 415 pn = bc->hrbuf;
418next_frame: 416 while (cnt > 0) {
419 if (test_bit(FLG_HDLC, &bc->bch.Flags)) {
420 stat = isdnhdlc_decode(&bc->hrecv, pn, cnt, &i, 417 stat = isdnhdlc_decode(&bc->hrecv, pn, cnt, &i,
421 bc->bch.rx_skb->data, bc->bch.maxlen); 418 bc->bch.rx_skb->data, bc->bch.maxlen);
422 if (stat > 0) /* valid frame received */ 419 if (stat > 0) { /* valid frame received */
423 p = skb_put(bc->bch.rx_skb, stat); 420 p = skb_put(bc->bch.rx_skb, stat);
424 else if (stat == -HDLC_CRC_ERROR) 421 if (debug & DEBUG_HW_BFIFO) {
422 snprintf(card->log, LOG_SIZE,
423 "B%1d-recv %s %d ", bc->bch.nr,
424 card->name, stat);
425 print_hex_dump_bytes(card->log,
426 DUMP_PREFIX_OFFSET, p,
427 stat);
428 }
429 recv_Bchannel(&bc->bch, 0);
430 stat = bchannel_get_rxbuf(&bc->bch, bc->bch.maxlen);
431 if (stat < 0) {
432 pr_warning("%s.B%d: No memory for %d bytes\n",
433 card->name, bc->bch.nr, cnt);
434 return;
435 }
436 } else if (stat == -HDLC_CRC_ERROR) {
425 pr_info("%s: B%1d receive frame CRC error\n", 437 pr_info("%s: B%1d receive frame CRC error\n",
426 card->name, bc->bch.nr); 438 card->name, bc->bch.nr);
427 else if (stat == -HDLC_FRAMING_ERROR) 439 } else if (stat == -HDLC_FRAMING_ERROR) {
428 pr_info("%s: B%1d receive framing error\n", 440 pr_info("%s: B%1d receive framing error\n",
429 card->name, bc->bch.nr); 441 card->name, bc->bch.nr);
430 else if (stat == -HDLC_LENGTH_ERROR) 442 } else if (stat == -HDLC_LENGTH_ERROR) {
431 pr_info("%s: B%1d receive frame too long (> %d)\n", 443 pr_info("%s: B%1d receive frame too long (> %d)\n",
432 card->name, bc->bch.nr, bc->bch.maxlen); 444 card->name, bc->bch.nr, bc->bch.maxlen);
433 } else
434 stat = cnt;
435
436 if (stat > 0) {
437 if (debug & DEBUG_HW_BFIFO) {
438 snprintf(card->log, LOG_SIZE, "B%1d-recv %s %d ",
439 bc->bch.nr, card->name, stat);
440 print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET,
441 p, stat);
442 } 445 }
443 recv_Bchannel(&bc->bch, 0);
444 }
445 if (test_bit(FLG_HDLC, &bc->bch.Flags)) {
446 pn += i; 446 pn += i;
447 cnt -= i; 447 cnt -= i;
448 if (!bc->bch.rx_skb) {
449 bc->bch.rx_skb = mI_alloc_skb(bc->bch.maxlen,
450 GFP_ATOMIC);
451 if (!bc->bch.rx_skb) {
452 pr_info("%s: B%1d receive out of memory\n",
453 card->name, bc->bch.nr);
454 return;
455 }
456 }
457 if (cnt > 0)
458 goto next_frame;
459 } 448 }
460} 449}
461 450