public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded•com>
To: Shradha Shah <sshah@solarflare•com>, netdev@vger•kernel.org
Cc: linux-net-drivers@solarflare•com
Subject: Re: [PATCH net v2 1/2] sfc: use 64-bit writes for PIO.
Date: Wed, 28 May 2014 18:48:57 +0400	[thread overview]
Message-ID: <5385F759.8010408@cogentembedded.com> (raw)
In-Reply-To: <5385ABE5.9070406@solarflare.com>

On 05/28/2014 01:27 PM, Shradha Shah wrote:

> From: Jon Cooper <jcooper@solarflare•com>

> Patch to open-code the memory copy routines.
> 32bit writes over the PCI bus causes data corruption.

> Fixes:ee45fd92c739db5b7950163d91dfe5f016af6d24

    Same comment as in the patch #2

> orig-hg-hash: 853f313def1e5e9c733f980f2b4e6330a7d063ef

    What's this?

> Signed-off-by: Shradha Shah <sshah@solarflare•com>
> ---
>   drivers/net/ethernet/sfc/tx.c | 24 +++++++++++++++++++-----
>   1 file changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
> index fa94753..bd6a4b8 100644
> --- a/drivers/net/ethernet/sfc/tx.c
> +++ b/drivers/net/ethernet/sfc/tx.c
> @@ -189,6 +189,20 @@ struct efx_short_copy_buffer {
>   	u8 buf[L1_CACHE_BYTES];
>   };
>
> +/* Copy in explicit 64-bit writes. */
> +static void efx_memcpy_64(void *dest, void *src, size_t len)
> +{
> +	uint64_t *src64 = src, *dest64 = dest;
> +	size_t i, l64 = len / 8;
> +
> +	WARN_ON_ONCE(len % 8 != 0);
> +	WARN_ON_ONCE(((u8 *)dest - (u8 *) 0) % 8 != 0);

    Be consistent with spaces after a typecast, please.

> +	BUILD_BUG_ON(sizeof(uint64_t) != 8);
> +
> +	for(i = 0; i < l64; ++i)
> +		dest64[i] = src64[i];
> +}
> +
>   /* Copy to PIO, respecting that writes to PIO buffers must be dword aligned.
>    * Advances piobuf pointer. Leaves additional data in the copy buffer.
>    */
[...]

WBR, Sergei

  parent reply	other threads:[~2014-05-28 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1401268725.git.sshah@solarflare.com>
2014-05-28  9:27 ` [PATCH net v2 1/2] sfc: use 64-bit writes for PIO Shradha Shah
2014-05-28  9:32   ` Shradha Shah
2014-05-28 14:48   ` Sergei Shtylyov [this message]
2014-05-28  9:28 ` [PATCH net v2 2/2] sfc: Restrict PIO to 64-bit architectures Shradha Shah
2014-05-28 14:45   ` Sergei Shtylyov
2014-05-28  9:23 [PATCH net v2 0/2] sfc: Restrict PIO for 64bit arch in order to avoid data corruption Shradha Shah
2014-05-28  9:28 ` [PATCH net v2 1/2] sfc: use 64-bit writes for PIO Shradha Shah

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=5385F759.8010408@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded$(echo .)com \
    --cc=linux-net-drivers@solarflare$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sshah@solarflare$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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