From: Michael Buesch <mb@bu3sch.de>
To: Brice Goglin <brice@myri.com>
Cc: Jeff Garzik <jeff@garzik.org>, netdev@vger.kernel.org
Subject: Re: [patch 2/2] myri10ge - Write the firmware in 256-bytes chunks
Date: Fri, 21 Jul 2006 22:11:20 +0200 [thread overview]
Message-ID: <200607212211.21043.mb@bu3sch.de> (raw)
In-Reply-To: <44C12FD9.3050001@myri.com>
On Friday 21 July 2006 21:49, Brice Goglin wrote:
> When writing the firmware to the NIC, the FIFO is 256-bytes long,
> so we use 256-bytes chunks and a read to wait until the previous
> write is done.
>
> Signed-off-by: Brice Goglin <brice@myri.com>
> ---
> drivers/net/myri10ge/myri10ge.c | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> Index: linux-mm/drivers/net/myri10ge/myri10ge.c
> ===================================================================
> --- linux-mm.orig/drivers/net/myri10ge/myri10ge.c 2006-07-18 15:17:55.000000000 -0400
> +++ linux-mm/drivers/net/myri10ge/myri10ge.c 2006-07-18 15:19:44.000000000 -0400
> @@ -448,6 +448,7 @@
> struct mcp_gen_header *hdr;
> size_t hdr_offset;
> int status;
> + unsigned i;
>
> if ((status = request_firmware(&fw, mgp->fw_name, dev)) < 0) {
> dev_err(dev, "Unable to load %s firmware image via hotplug\n",
> @@ -479,18 +480,13 @@
> goto abort_with_fw;
>
> crc = crc32(~0, fw->data, fw->size);
> - if (mgp->tx.boundary == 2048) {
> - /* Avoid PCI burst on chipset with unaligned completions. */
> - int i;
> - __iomem u32 *ptr = (__iomem u32 *) (mgp->sram +
> - MYRI10GE_FW_OFFSET);
> - for (i = 0; i < fw->size / 4; i++) {
> - __raw_writel(((u32 *) fw->data)[i], ptr + i);
> - wmb();
> - }
> - } else {
> - myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET, fw->data,
> - fw->size);
> + for (i = 0; i < fw->size; i += 256) {
> + myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET + i,
> + fw->data + i,
> + min(256U, (unsigned)(fw->size - i)));
> + mb();
> + readb(mgp->sram);
> + mb();
Why two mb() here?
I would say actually none is needed.
The readb fully synchronizes the previous writes on bus level
(and so on CPU level, too).
--
Greetings Michael.
next prev parent reply other threads:[~2006-07-21 20:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <44C12D14.7050509@myri.com>
2006-07-21 19:49 ` [patch 1/2] myri10ge - Always do a dummy RDMA after loading the firmware Brice Goglin
2006-07-21 19:49 ` [patch 2/2] myri10ge - Write the firmware in 256-bytes chunks Brice Goglin
2006-07-21 20:11 ` Michael Buesch [this message]
2006-07-22 2:42 ` Brice Goglin
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=200607212211.21043.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=brice@myri.com \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.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).