netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rainer Weikusat <rainer.weikusat@sncag.com>
To: Jean-Baptiste Note <jean-baptiste.note@wanadoo.fr>
Cc: netdev@oss.sgi.com, prism54-devel@prism54.org
Subject: Re: Question on prism54 driver
Date: Thu, 14 Apr 2005 11:04:40 +0200	[thread overview]
Message-ID: <87hdi9sp93.fsf@farside.sncag.com> (raw)
In-Reply-To: <87fyxu5oin.fsf@gxaafoot.homelinux.org> (Jean-Baptiste Note's message of "Wed, 13 Apr 2005 23:56:48 +0200")

Jean-Baptiste Note <jean-baptiste.note@wanadoo.fr> writes:
> Going through the prism54 code for reuse in the softmac driver, i
> stumbled accross inconsistencies in the queue management functions for
> the mgmt rx queue and the data rx queue that i cannot understand.
>
> Is there any reason that we have the following call in
> islpci_mgt_receive (file islpci_mgt.c):
>
> 		/* Ensure the results of device DMA are visible to the CPU. */
> 		pci_dma_sync_single(priv->pdev, buf->pci_addr,
> 				    frag_len, PCI_DMA_FROMDEVICE);
>
> but have nothing of the sort in islpci_eth_receive (file islpci_eth.c)?
>
> In the same spirit, the control block is also written by DMA by the
> device, I guess ; so how comes we don't have such a syncing call in the
> interrupt handler before accessing the control block's values (file
> islpci_dev.c) ?
>
> Am i missing something very obvious or very subtle?

<sigh>
No, you are just hacking the code without even having tried to
understand

	a) what it is doing
        b) why it does this
[which, "by coincedence", happens to be the reason that this driver is
 so thouroughly broken]
</sigh>

The data transfers (all of them) use streaming DMA mappings, which
have to be synced explicitly between 'bus view' and 'CPU view',
because they may involve bounce buffers (in 2.4) and to ensure that
data the CPU has written to the cache is actually in memory and data
the DMA engine has written is not ignored because of (actually stale)
cache entries that predate it. The mgmt-queues use persistent
streaming mapping, which means they have to be synced everytime the
CPU intends to access them after they were accessed by the DMA engine.
The skbuffs used by the data transfer code are mapped before they are
passed to the device and unmapped (which syncs them) before the CPU
accesses them. This isn't needed for the control block, because it is
a consistent and not a streaming mapping.

BTW, I shouldn't be telling you how your code works, don't you think
so?

  reply	other threads:[~2005-04-14  9:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13 21:56 Question on prism54 driver Jean-Baptiste Note
2005-04-14  9:04 ` Rainer Weikusat [this message]
2005-04-14 11:25   ` Jean-Baptiste Note

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=87hdi9sp93.fsf@farside.sncag.com \
    --to=rainer.weikusat@sncag.com \
    --cc=jean-baptiste.note@wanadoo.fr \
    --cc=netdev@oss.sgi.com \
    --cc=prism54-devel@prism54.org \
    /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;
as well as URLs for NNTP newsgroup(s).