mISDNisar.c (8bfddfbe2100862fd39b97001d0559ccd4c77f19) mISDNisar.c (7206e659f689558b41aa058c3040b081cb281d03)
1/*
2 * mISDNisar.c ISAR (Siemens PSB 7110) specific functions
3 *
4 * Author Karsten Keil (keil@isdn4linux.de)
5 *
6 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 407 unchanged lines hidden (view full) ---

416{
417 pr_debug("%s: HL->LL FAXIND %x\n", ch->is->name, status);
418 _queue_data(&ch->bch.ch, PH_CONTROL_IND, status, 0, NULL, GFP_ATOMIC);
419}
420
421static inline void
422isar_rcv_frame(struct isar_ch *ch)
423{
1/*
2 * mISDNisar.c ISAR (Siemens PSB 7110) specific functions
3 *
4 * Author Karsten Keil (keil@isdn4linux.de)
5 *
6 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 407 unchanged lines hidden (view full) ---

416{
417 pr_debug("%s: HL->LL FAXIND %x\n", ch->is->name, status);
418 _queue_data(&ch->bch.ch, PH_CONTROL_IND, status, 0, NULL, GFP_ATOMIC);
419}
420
421static inline void
422isar_rcv_frame(struct isar_ch *ch)
423{
424 u8 *ptr;
424 u8 *ptr;
425 int maxlen;
425
426 if (!ch->is->clsb) {
427 pr_debug("%s; ISAR zero len frame\n", ch->is->name);
428 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
429 return;
430 }
431 switch (ch->bch.state) {
432 case ISDN_P_NONE:
433 pr_debug("%s: ISAR protocol 0 spurious IIS_RDATA %x/%x/%x\n",
434 ch->is->name, ch->is->iis, ch->is->cmsb, ch->is->clsb);
435 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
436 break;
437 case ISDN_P_B_RAW:
438 case ISDN_P_B_L2DTMF:
439 case ISDN_P_B_MODEM_ASYNC:
426
427 if (!ch->is->clsb) {
428 pr_debug("%s; ISAR zero len frame\n", ch->is->name);
429 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
430 return;
431 }
432 switch (ch->bch.state) {
433 case ISDN_P_NONE:
434 pr_debug("%s: ISAR protocol 0 spurious IIS_RDATA %x/%x/%x\n",
435 ch->is->name, ch->is->iis, ch->is->cmsb, ch->is->clsb);
436 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
437 break;
438 case ISDN_P_B_RAW:
439 case ISDN_P_B_L2DTMF:
440 case ISDN_P_B_MODEM_ASYNC:
440 if (!ch->bch.rx_skb) {
441 ch->bch.rx_skb = mI_alloc_skb(ch->bch.maxlen,
442 GFP_ATOMIC);
443 if (unlikely(!ch->bch.rx_skb)) {
444 pr_info("%s: B receive out of memory\n",
445 ch->is->name);
446 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
447 break;
448 }
441 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb);
442 if (maxlen < 0) {
443 pr_warning("%s.B%d: No bufferspace for %d bytes\n",
444 ch->is->name, ch->bch.nr, ch->is->clsb);
445 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
446 break;
449 }
450 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb));
451 recv_Bchannel(&ch->bch, 0);
452 break;
453 case ISDN_P_B_HDLC:
447 }
448 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb));
449 recv_Bchannel(&ch->bch, 0);
450 break;
451 case ISDN_P_B_HDLC:
454 if (!ch->bch.rx_skb) {
455 ch->bch.rx_skb = mI_alloc_skb(ch->bch.maxlen,
456 GFP_ATOMIC);
457 if (unlikely(!ch->bch.rx_skb)) {
458 pr_info("%s: B receive out of memory\n",
459 ch->is->name);
460 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
461 break;
462 }
463 }
464 if ((ch->bch.rx_skb->len + ch->is->clsb) >
465 (ch->bch.maxlen + 2)) {
466 pr_debug("%s: incoming packet too large\n",
467 ch->is->name);
452 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb);
453 if (maxlen < 0) {
454 pr_warning("%s.B%d: No bufferspace for %d bytes\n",
455 ch->is->name, ch->bch.nr, ch->is->clsb);
468 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
456 ch->is->write_reg(ch->is->hw, ISAR_IIA, 0);
469 skb_trim(ch->bch.rx_skb, 0);
470 break;
471 }
472 if (ch->is->cmsb & HDLC_ERROR) {
473 pr_debug("%s: ISAR frame error %x len %d\n",
474 ch->is->name, ch->is->cmsb, ch->is->clsb);
475#ifdef ERROR_STATISTIC
476 if (ch->is->cmsb & HDLC_ERR_RER)
477 ch->bch.err_inv++;

--- 1238 unchanged lines hidden ---
457 break;
458 }
459 if (ch->is->cmsb & HDLC_ERROR) {
460 pr_debug("%s: ISAR frame error %x len %d\n",
461 ch->is->name, ch->is->cmsb, ch->is->clsb);
462#ifdef ERROR_STATISTIC
463 if (ch->is->cmsb & HDLC_ERR_RER)
464 ch->bch.err_inv++;

--- 1238 unchanged lines hidden ---