All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Eli Cohen <eli@dev.mellanox.co.il>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Eli Cohen <eli@mellanox.co.il>,
	linuxppc-dev@lists.ozlabs.org,
	Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
	Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Subject: Re: [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled
Date: Sun, 09 Oct 2011 10:00:54 +0200	[thread overview]
Message-ID: <1318147254.29415.377.camel@pasglop> (raw)
In-Reply-To: <20111009073546.GI2681@mtldesk30>

On Sun, 2011-10-09 at 09:35 +0200, Eli Cohen wrote:
> On Sun, Oct 09, 2011 at 09:25:18AM +0200, Benjamin Herrenschmidt wrote:
> > On Thu, 2011-10-06 at 15:57 +0200, Eli Cohen wrote:
> > > On Wed, Oct 05, 2011 at 10:15:02AM +0200, Eli Cohen wrote:
> > > 
> > > How about this patch - can you give it a try?
> > > 
> > > 
> > > >From dee60547aa9e35a02835451d9e694cd80dd3072f Mon Sep 17 00:00:00 2001
> > > From: Eli Cohen <eli@mellanox.co.il>
> > > Date: Thu, 6 Oct 2011 15:50:02 +0200
> > > Subject: [PATCH] mlx4_en: Fix blue flame on powerpc
> > > 
> > > The source buffer used for copying into the blue flame register is already in
> > > big endian. However, when copying to device on powerpc, the endianess is
> > > swapped so the data reaches th device in little endian which is wrong. On x86
> > > based platform no swapping occurs so it reaches the device with the correct
> > > endianess. Fix this by calling le32_to_cpu() on the buffer. On LE systems there
> > > is no change; on BE there will be a swap.
> > 
> > That looks wrong.
> Not sure I understand: are you saying that on ppc, when you call
> __iowrite64_copy, it will not reach the device swapped?

Well, first, what do you mean by "swapped" ? :-) But no, it won't for
all intend and purpose, this is a copy routine, copy routines never
swap, neither do fifo accesses for example.

> The point is that we must always have the buffer ready in big endian
> in memory. In the case of blue flame, we must also copy it to the
> device registers in pci memory space. So if we use the buffer we
> already prepared, we must have another swap. I can think of a nicer
> way to implement this functionality but the question is do you think
> my observation above is wrong and why.

No. If it's in memory BE then the copy routine will keep it BE. A copy
routine doesn't swap and doesn't affect endianness.

Additionally, a swapping phase like you proposed doing 32-bit swaps
means that you know for sure that the buffer is made of 32-bit
quantities, is that the case ? Even if you had needed that swap, if your
buffer had contained 16-bit or 64-bit quantities, you're toast.

What is this buffer anyway ? A descriptor or a network packet ?

If it's a packet, then it's data, endianness has no meaning (or rather
it has for individual fields of the packets but they are already in the
right format and a 32-bit swap will never be right).
 
It's almost never right to perform swapping when copying data (or
reading/writing a FIFO).

Cheers,
Ben.

  reply	other threads:[~2011-10-09  8:01 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 13:23 [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled Thadeu Lima de Souza Cascardo
2011-10-02  8:58 ` Yevgeny Petrilin
2011-10-03 14:37   ` Thadeu Lima de Souza Cascardo
2011-10-03 14:56     ` Yevgeny Petrilin
2011-10-03 20:53       ` Thadeu Lima de Souza Cascardo
2011-10-03 20:53         ` Thadeu Lima de Souza Cascardo
2011-10-04  6:02         ` Benjamin Herrenschmidt
2011-10-04  6:02           ` Benjamin Herrenschmidt
2011-10-04 20:26           ` Thadeu Lima de Souza Cascardo
2011-10-04 20:26             ` Thadeu Lima de Souza Cascardo
2011-10-05  8:15             ` Eli Cohen
2011-10-05  8:15               ` Eli Cohen
2011-10-06 13:57               ` Eli Cohen
2011-10-06 13:57                 ` Eli Cohen
2011-10-06 14:10                 ` [PATCH] mlx4_en: fix transmit of packages when blue frame isenabled David Laight
2011-10-06 14:10                   ` David Laight
2011-10-07 22:29                   ` Thadeu Lima de Souza Cascardo
2011-10-07 22:29                     ` Thadeu Lima de Souza Cascardo
2011-10-09  7:28                   ` Benjamin Herrenschmidt
2011-10-09  7:28                     ` Benjamin Herrenschmidt
2011-10-09  7:25                 ` [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled Benjamin Herrenschmidt
2011-10-09  7:25                   ` Benjamin Herrenschmidt
2011-10-09  7:35                   ` Eli Cohen
2011-10-09  7:35                     ` Eli Cohen
2011-10-09  8:00                     ` Benjamin Herrenschmidt [this message]
2011-10-09  8:07                       ` Eli Cohen
2011-10-09  8:07                         ` Eli Cohen
2011-10-09  8:38                         ` Benjamin Herrenschmidt
2011-10-09  8:38                           ` Benjamin Herrenschmidt
2011-10-09  9:21                           ` Eli Cohen
2011-10-09  9:21                             ` Eli Cohen
2011-10-09  9:52                             ` Benjamin Herrenschmidt
2011-10-09  9:52                               ` Benjamin Herrenschmidt
2011-10-09 10:30                               ` Eli Cohen
2011-10-09 10:30                                 ` Eli Cohen
2011-10-10  7:32                                 ` Benjamin Herrenschmidt
2011-10-10  7:32                                   ` Benjamin Herrenschmidt
2011-10-10 16:42                                   ` [PATCH] mlx4_en: fix endianness with blue frame support Thadeu Lima de Souza Cascardo
2011-10-10 16:42                                     ` Thadeu Lima de Souza Cascardo
2011-10-10 16:46                                     ` Thadeu Lima de Souza Cascardo
2011-10-10 16:46                                       ` Thadeu Lima de Souza Cascardo
2011-10-10 18:10                                       ` David Miller
2011-10-10 18:10                                         ` David Miller
2011-10-10  8:20                               ` [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled David Laight
2011-10-10  8:20                                 ` David Laight
2011-10-10  8:29                                 ` Benjamin Herrenschmidt
2011-10-10  8:29                                   ` Benjamin Herrenschmidt
2011-10-10  8:40                   ` David Laight
2011-10-10  8:40                     ` David Laight
2011-10-10  8:47                     ` Eli Cohen
2011-10-10  9:01                       ` Benjamin Herrenschmidt
2011-10-10  9:01                         ` Benjamin Herrenschmidt
2011-10-10  9:16                         ` Eli Cohen
2011-10-10  9:16                           ` Eli Cohen
2011-10-10  9:24                           ` Benjamin Herrenschmidt
2011-10-10  9:24                             ` Benjamin Herrenschmidt
2011-10-10  9:29                             ` Eli Cohen
2011-10-10  9:29                               ` Eli Cohen
2011-10-10 10:18                               ` Benjamin Herrenschmidt
2011-10-10 10:18                                 ` Benjamin Herrenschmidt
2011-10-10  8:53                     ` Benjamin Herrenschmidt
2011-10-10  8:53                       ` Benjamin Herrenschmidt
2011-10-09  7:21               ` Benjamin Herrenschmidt
2011-10-09  7:21                 ` Benjamin Herrenschmidt
2011-10-09  7:19             ` Benjamin Herrenschmidt

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=1318147254.29415.377.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=cascardo@linux.vnet.ibm.com \
    --cc=eli@dev.mellanox.co.il \
    --cc=eli@mellanox.co.il \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=yevgenyp@mellanox.co.il \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.