diff options
Diffstat (limited to 'drivers/isdn/hardware/mISDN/hfcsusb.c')
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfcsusb.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 919ecccb9939..6bb689b8d66f 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c | |||
@@ -860,7 +860,16 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len, | |||
860 | hdlc = 1; | 860 | hdlc = 1; |
861 | } | 861 | } |
862 | if (fifo->bch) { | 862 | if (fifo->bch) { |
863 | maxlen = bchannel_get_rxbuf(fifo->bch, len); | ||
863 | rx_skb = fifo->bch->rx_skb; | 864 | rx_skb = fifo->bch->rx_skb; |
865 | if (maxlen < 0) { | ||
866 | if (rx_skb) | ||
867 | skb_trim(rx_skb, 0); | ||
868 | pr_warning("%s.B%d: No bufferspace for %d bytes\n", | ||
869 | hw->name, fifo->bch->nr, len); | ||
870 | spin_unlock(&hw->lock); | ||
871 | return; | ||
872 | } | ||
864 | maxlen = fifo->bch->maxlen; | 873 | maxlen = fifo->bch->maxlen; |
865 | hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); | 874 | hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); |
866 | } | 875 | } |
@@ -870,25 +879,22 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len, | |||
870 | hdlc = 1; | 879 | hdlc = 1; |
871 | } | 880 | } |
872 | 881 | ||
873 | if (!rx_skb) { | ||
874 | rx_skb = mI_alloc_skb(maxlen, GFP_ATOMIC); | ||
875 | if (rx_skb) { | ||
876 | if (fifo->dch) | ||
877 | fifo->dch->rx_skb = rx_skb; | ||
878 | if (fifo->bch) | ||
879 | fifo->bch->rx_skb = rx_skb; | ||
880 | if (fifo->ech) | ||
881 | fifo->ech->rx_skb = rx_skb; | ||
882 | skb_trim(rx_skb, 0); | ||
883 | } else { | ||
884 | printk(KERN_DEBUG "%s: %s: No mem for rx_skb\n", | ||
885 | hw->name, __func__); | ||
886 | spin_unlock(&hw->lock); | ||
887 | return; | ||
888 | } | ||
889 | } | ||
890 | |||
891 | if (fifo->dch || fifo->ech) { | 882 | if (fifo->dch || fifo->ech) { |
883 | if (!rx_skb) { | ||
884 | rx_skb = mI_alloc_skb(maxlen, GFP_ATOMIC); | ||
885 | if (rx_skb) { | ||
886 | if (fifo->dch) | ||
887 | fifo->dch->rx_skb = rx_skb; | ||
888 | if (fifo->ech) | ||
889 | fifo->ech->rx_skb = rx_skb; | ||
890 | skb_trim(rx_skb, 0); | ||
891 | } else { | ||
892 | printk(KERN_DEBUG "%s: %s: No mem for rx_skb\n", | ||
893 | hw->name, __func__); | ||
894 | spin_unlock(&hw->lock); | ||
895 | return; | ||
896 | } | ||
897 | } | ||
892 | /* D/E-Channel SKB range check */ | 898 | /* D/E-Channel SKB range check */ |
893 | if ((rx_skb->len + len) >= MAX_DFRAME_LEN_L1) { | 899 | if ((rx_skb->len + len) >= MAX_DFRAME_LEN_L1) { |
894 | printk(KERN_DEBUG "%s: %s: sbk mem exceeded " | 900 | printk(KERN_DEBUG "%s: %s: sbk mem exceeded " |
@@ -898,16 +904,6 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len, | |||
898 | spin_unlock(&hw->lock); | 904 | spin_unlock(&hw->lock); |
899 | return; | 905 | return; |
900 | } | 906 | } |
901 | } else if (fifo->bch) { | ||
902 | /* B-Channel SKB range check */ | ||
903 | if ((rx_skb->len + len) >= (MAX_BCH_SIZE + 3)) { | ||
904 | printk(KERN_DEBUG "%s: %s: sbk mem exceeded " | ||
905 | "for fifo(%d) HFCUSB_B_RX\n", | ||
906 | hw->name, __func__, fifon); | ||
907 | skb_trim(rx_skb, 0); | ||
908 | spin_unlock(&hw->lock); | ||
909 | return; | ||
910 | } | ||
911 | } | 907 | } |
912 | 908 | ||
913 | memcpy(skb_put(rx_skb, len), data, len); | 909 | memcpy(skb_put(rx_skb, len), data, len); |