diff options
author | Karsten Keil <kkeil@linux-pingi.de> | 2012-05-16 03:51:05 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 23:23:28 +0400 |
commit | 7206e659f689558b41aa058c3040b081cb281d03 (patch) | |
tree | 2be5bdef5a0bbb9c5763b8c1b1e6fe04b7184cc5 /drivers/isdn/hardware/mISDN/w6692.c | |
parent | 37952cfa3afdfa5cec39d9d76e80bc3a0e6a910c (diff) | |
download | linux-7206e659f689558b41aa058c3040b081cb281d03.tar.xz |
mISDN: Reduce RX buffer allocation for transparent data
We did allways allocate maxsize buffers, but for transparent data we know
the actual size.
Use a common function to calculate size and detect overflows.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware/mISDN/w6692.c')
-rw-r--r-- | drivers/isdn/hardware/mISDN/w6692.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c index f1c0bf1ac689..8324b20c7f16 100644 --- a/drivers/isdn/hardware/mISDN/w6692.c +++ b/drivers/isdn/hardware/mISDN/w6692.c @@ -465,6 +465,7 @@ W6692_empty_Bfifo(struct w6692_ch *wch, int count) { struct w6692_hw *card = wch->bch.hw; u8 *ptr; + int maxlen; pr_debug("%s: empty_Bfifo %d\n", card->name, count); if (unlikely(wch->bch.state == ISDN_P_NONE)) { @@ -474,20 +475,13 @@ W6692_empty_Bfifo(struct w6692_ch *wch, int count) skb_trim(wch->bch.rx_skb, 0); return; } - if (!wch->bch.rx_skb) { - wch->bch.rx_skb = mI_alloc_skb(wch->bch.maxlen, GFP_ATOMIC); - if (unlikely(!wch->bch.rx_skb)) { - pr_info("%s: B receive out of memory\n", card->name); - WriteW6692B(wch, W_B_CMDR, W_B_CMDR_RACK | - W_B_CMDR_RACT); - return; - } - } - if (wch->bch.rx_skb->len + count > wch->bch.maxlen) { - pr_debug("%s: empty_Bfifo incoming packet too large\n", - card->name); + maxlen = bchannel_get_rxbuf(&wch->bch, count); + if (maxlen < 0) { WriteW6692B(wch, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); - skb_trim(wch->bch.rx_skb, 0); + if (wch->bch.rx_skb) + skb_trim(wch->bch.rx_skb, 0); + pr_warning("%s.B%d: No bufferspace for %d bytes\n", + card->name, wch->bch.nr, count); return; } ptr = skb_put(wch->bch.rx_skb, count); |