Thread: [Linux1394-cvslog] rev 750 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <dm...@li...> - 2003-02-01 14:00:04
|
Author: dmaas Date: 2003-01-15 06:43:05 -0500 (Wed, 15 Jan 2003) New Revision: 750 Modified: trunk/hosts.h trunk/iso.c trunk/ohci1394.c Log: rawiso - more cleanups Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c 2003-02-01 08:59:31.000000000 -0500 @@ -1490,16 +1490,13 @@ recv->block_reader = (recv->block_reader + 1) % recv->nblocks; } -static void ohci_iso_recv_release_one_packet(struct hpsb_iso *iso, struct ohci_iso_recv *recv) +static void ohci_iso_recv_release(struct hpsb_iso *iso, struct hpsb_iso_packet_info *info) { - int flags; + struct ohci_iso_recv *recv = iso->hostdata; int len; /* release the memory where the packet was */ - /* note: we can't trust len, but the worst the user - can do is mess up his own received packets */ - - len = iso->infos[iso->first_packet].len; + len = info->len; /* add the wasted space for padding to 4 bytes */ if(len % 4) @@ -1515,20 +1512,6 @@ ohci_iso_recv_release_block(iso, recv); recv->released_bytes -= PAGE_SIZE; } - - /* advance packet cursors */ - iso->first_packet = (iso->first_packet+1) % iso->buf_packets; - - spin_lock_irqsave(&iso->lock, flags); - iso->n_ready_packets--; - spin_unlock_irqrestore(&iso->lock, flags); -} - -static void ohci_iso_recv_release(struct hpsb_iso *iso, int n_packets) -{ - int i; - for(i = 0; i < n_packets; i++) - ohci_iso_recv_release_one_packet(iso, (struct ohci_iso_recv*) iso->hostdata); } /* parse all packets from blocks that have been fully received */ @@ -2017,7 +2000,7 @@ ohci_iso_recv_stop(iso); return 0; case RECV_RELEASE: - ohci_iso_recv_release(iso, arg); + ohci_iso_recv_release(iso, (struct hpsb_iso_packet_info*) arg); return 0; case RECV_SHUTDOWN: ohci_iso_recv_shutdown(iso); Modified: trunk/hosts.h ============================================================================== --- trunk/hosts.h (original) +++ trunk/hosts.h 2003-02-01 08:59:32.000000000 -0500 @@ -108,9 +108,9 @@ enum isoctl_cmd { /* rawiso API - see iso.h for the meanings of these commands * INIT = allocate resources - * START = begin transmission/reception (arg: cycle to start on) + * START = begin transmission/reception * STOP = halt transmission/reception - * QUEUE/RELEASE = produce/consume packets (arg: # of packets) + * QUEUE/RELEASE = produce/consume packets * SHUTDOWN = deallocate resources */ Modified: trunk/iso.c ============================================================================== --- trunk/iso.c (original) +++ trunk/iso.c 2003-02-01 08:59:32.000000000 -0500 @@ -388,7 +388,6 @@ if(iso->n_ready_packets == iso->buf_packets) { /* overflow! */ atomic_inc(&iso->overflows); - return; } else { struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma]; info->offset = offset; @@ -407,10 +406,25 @@ int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets) { + unsigned long flags; + unsigned int i; + int rv = 0; + if(iso->type != HPSB_ISO_RECV) return -1; - return iso->host->driver->isoctl(iso, RECV_RELEASE, n_packets); + spin_lock_irqsave(&iso->lock, flags); + for(i = 0; i < n_packets; i++) { + rv = iso->host->driver->isoctl(iso, RECV_RELEASE, + (unsigned long) &iso->infos[iso->first_packet]); + if(rv) + break; + + iso->first_packet = (iso->first_packet+1) % iso->buf_packets; + iso->n_ready_packets--; + } + spin_unlock_irqrestore(&iso->lock, flags); + return rv; } void hpsb_iso_wake(struct hpsb_iso *iso) |