linuxppc-dev.lists.ozlabs.org archive mirror
 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:38:56 +0200	[thread overview]
Message-ID: <1318149536.29415.384.camel@pasglop> (raw)
In-Reply-To: <20111009080747.GJ2681@mtldesk30>

On Sun, 2011-10-09 at 10:07 +0200, Eli Cohen wrote:

> > 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.
> When I say swapped, I mean not necessairliy by software. I think that
> the chipset will swap the the data. The reason I think so is that the
> CPU arch is big endian, while PCI bus is defined as little endian.
> That's why I think a swap will occur in ppc and not in x86.

No it won't "swap the data". The wiring between PCI and the CPU bus is
done in a way called "byte address invariant", and there is some kind of
flip of byte lanes related essentially to ensure that, but for all
intend and purpose it's transparent.

> It's a special descriptor that resides both in memory and also written
> to the device's register. An it contains both data and control
> informartion.

Data should not be swapped then. Only individual bits of control
information. In any case, the buffer should be generated in the right
format in memory to start with. The copy routine doesn't need to swap.

To go back to the driver code, the statements that ring a "bell" are:

	*(u32 *) (&tx_desc->ctrl.vlan_tag) |= ring->doorbell_qpn;

This doesn't look right unless "doorbell_qpn" itself is already somewhat
in the appropriate byte order.

Is that vlan_tag a big or little endian quantity ? Either way, this
looks broken in either x86 or ppc unless doorbell_qpn itself is already
in the right endian.

But since later I see

	writel(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);

That rings a nasty bell, it looks like doorbell_pqn is in CPU (native)
endian, so it should have to be swapped before being OR'ed into the
descriptor, either that or the HW does some black magic I don't
understand.

Cheers,
Ben.

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

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1317388995-411-1-git-send-email-cascardo@linux.vnet.ibm.com>
     [not found] ` <953B660C027164448AE903364AC447D2235D9A8C@MTLDAG02.mtl.com>
     [not found]   ` <20111003143721.GA3596@oc1711230544.ibm.com>
     [not found]     ` <953B660C027164448AE903364AC447D2235DAA9D@MTLDAG02.mtl.com>
2011-10-03 20:53       ` [PATCH] mlx4_en: fix transmit of packages when blue frame is enabled Thadeu Lima de Souza Cascardo
2011-10-04  6:02         ` Benjamin Herrenschmidt
2011-10-04 20:26           ` Thadeu Lima de Souza Cascardo
2011-10-05  8:15             ` 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-07 22:29                   ` Thadeu Lima de Souza Cascardo
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:35                   ` Eli Cohen
2011-10-09  8:00                     ` Benjamin Herrenschmidt
2011-10-09  8:07                       ` Eli Cohen
2011-10-09  8:38                         ` Benjamin Herrenschmidt [this message]
2011-10-09  9:21                           ` Eli Cohen
2011-10-09  9:52                             ` Benjamin Herrenschmidt
2011-10-09 10:30                               ` Eli Cohen
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:46                                     ` Thadeu Lima de Souza Cascardo
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:29                                 ` Benjamin Herrenschmidt
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:16                         ` Eli Cohen
2011-10-10  9:24                           ` Benjamin Herrenschmidt
2011-10-10  9:29                             ` Eli Cohen
2011-10-10 10:18                               ` Benjamin Herrenschmidt
2011-10-10  8:53                     ` 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=1318149536.29415.384.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 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).