From: Jim Westfall <jwestfall@surrealistic.net>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] ieee1394: speed up of dma_region_sync_for_cpu
Date: Sun, 5 Mar 2006 10:05:47 -0800 [thread overview]
Message-ID: <20060305180547.GB1055@surrealistic.net> (raw)
when attempting to find the 'last' part of the dma region continue the
search from where we left off, instead of starting the search over.
Signed-off-by: Jim Westfall <jwestfall@surrealistic.net>
--- linux-2.6.15.4/drivers/ieee1394/dma.c.orig 2006-03-01 13:37:45.000000000 -0800
+++ linux-2.6.15.4/drivers/ieee1394/dma.c 2006-03-01 14:32:16.000000000 -0800
@@ -137,12 +137,12 @@ void dma_region_free(struct dma_region *
/* find the scatterlist index and remaining offset corresponding to a
given offset from the beginning of the buffer */
-static inline int dma_region_find(struct dma_region *dma, unsigned long offset, unsigned long *rem)
+static inline int dma_region_find(struct dma_region *dma, unsigned long offset, unsigned int start, unsigned long *rem)
{
int i;
unsigned long off = offset;
- for (i = 0; i < dma->n_dma_pages; i++) {
+ for (i = start; i < dma->n_dma_pages; i++) {
if (off < sg_dma_len(&dma->sglist[i])) {
*rem = off;
break;
@@ -160,7 +160,7 @@ dma_addr_t dma_region_offset_to_bus(stru
{
unsigned long rem = 0;
- struct scatterlist *sg = &dma->sglist[dma_region_find(dma, offset, &rem)];
+ struct scatterlist *sg = &dma->sglist[dma_region_find(dma, offset, 0, &rem)];
return sg_dma_address(sg) + rem;
}
@@ -172,8 +172,8 @@ void dma_region_sync_for_cpu(struct dma_
if (!len)
len = 1;
- first = dma_region_find(dma, offset, &rem);
- last = dma_region_find(dma, offset + len - 1, &rem);
+ first = dma_region_find(dma, offset, 0, &rem);
+ last = dma_region_find(dma, rem + len - 1, first, &rem);
pci_dma_sync_sg_for_cpu(dma->dev, &dma->sglist[first], last - first + 1, dma->direction);
}
@@ -186,8 +186,8 @@ void dma_region_sync_for_device(struct d
if (!len)
len = 1;
- first = dma_region_find(dma, offset, &rem);
- last = dma_region_find(dma, offset + len - 1, &rem);
+ first = dma_region_find(dma, offset, 0, &rem);
+ last = dma_region_find(dma, rem + len - 1, first, &rem);
pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], last - first + 1, dma->direction);
}
reply other threads:[~2006-03-05 18:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060305180547.GB1055@surrealistic.net \
--to=jwestfall@surrealistic.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®