patch-2.3.47 linux/drivers/ieee1394/raw1394.c
Next file: linux/drivers/isdn/isdn_net.c
Previous file: linux/drivers/ieee1394/pcilynx.h
Back to the patch index
Back to the overall index
- Lines: 46
- Date:
Sun Feb 20 20:32:50 2000
- Orig file:
v2.3.46/linux/drivers/ieee1394/raw1394.c
- Orig date:
Tue Feb 1 01:35:43 2000
diff -u --recursive --new-file v2.3.46/linux/drivers/ieee1394/raw1394.c linux/drivers/ieee1394/raw1394.c
@@ -3,7 +3,7 @@
*
* Raw interface to the bus
*
- * Copyright (C) 1999 Andreas E. Bombe
+ * Copyright (C) 1999, 2000 Andreas E. Bombe
*/
#include <linux/kernel.h>
@@ -30,6 +30,9 @@
static struct hpsb_highlevel *hl_handle = NULL;
+static atomic_t iso_buffer_size;
+static const int iso_buffer_max = 4 * 1024 * 1024; /* 4 MB */
+
static void queue_complete_cb(struct pending_request *req);
static struct pending_request *__alloc_pending_request(int flags)
@@ -56,6 +59,7 @@
{
if (req->ibs) {
if (atomic_dec_and_test(&req->ibs->refcount)) {
+ atomic_sub((req->data[0] >> 16) + 4, &iso_buffer_size);
kfree(req->ibs);
}
} else if (req->free_data) {
@@ -210,6 +214,10 @@
struct iso_block_store *ibs = NULL;
LIST_HEAD(reqs);
+ if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) {
+ return;
+ }
+
spin_lock_irqsave(&host_info_lock, flags);
hi = find_host_info(host);
@@ -227,6 +235,7 @@
+ length, SLAB_ATOMIC);
if (!ibs) break;
+ atomic_add(length, &iso_buffer_size);
atomic_set(&ibs->refcount, 0);
memcpy(ibs->data, data, length);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)