linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: "Alexandra N. Kossovsky" <sasha@oktet.ru>
Cc: linux-kernel@vger.kernel.org, ShuChen <shuchen@realtek.com.tw>,
	netdev@oss.sgi.com
Subject: Re: r8169 with big-endian (patch)
Date: Wed, 5 Nov 2003 19:34:00 +0100	[thread overview]
Message-ID: <20031105193400.A12375@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <20031105104625.D26209@oktet.ru>; from sasha@oktet.ru on Wed, Nov 05, 2003 at 10:46:26AM +0300

Greetings,

Alexandra N. Kossovsky <sasha@oktet.ru> :
[...]
> Here is the patch to make RTL-8169 PCI Gbit ethernet card to work with
> big-endian host. The patch is against 2.4.22 kernel.

Please Cc: such patches to netdev@oss.sgi.com as well as jgarzik@pobox.com.

[...]
> @@ -664,19 +675,21 @@
>  	}
>  
>  	tp->TxDescArrays =
> -	    kmalloc(NUM_TX_DESC * sizeof (struct TxDesc) + 256, GFP_KERNEL);
> +	    pci_alloc_consistent(tp->pci_dev,
> +				 NUM_TX_DESC * sizeof (struct TxDesc) + 256, 
> +				 &tp->TxDescDmaAddrs);
> -	TxPhyAddr = virt_to_bus(tp->TxDescArrays);
> -	diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
> -	TxPhyAddr += diff;
> +	diff = 256 - (tp->TxDescDmaAddrs - ((tp->TxDescDmaAddrs >> 8) << 8));
> +	tp->TxDescDmaAddr = tp->TxDescDmaAddrs + diff;
>  	tp->TxDescArray = (struct TxDesc *) (tp->TxDescArrays + diff);

Remove the alignment stuff. pci_alloc_consistent() does it for you,
see Documentation/DMA-mapping.txt:
[...]
The cpu return address and the DMA bus master address are both
guaranteed to be aligned to the smallest PAGE_SIZE order which
is greater than or equal to the requested size.  This invariant


@@ -684,12 +697,18 @@
[...]
-       tp->RxBufferRings = kmalloc(RX_BUF_SIZE * NUM_RX_DESC, GFP_KERNEL);
+       tp->RxBufferRings = pci_alloc_consistent(tp->pci_dev,
+                                                RX_BUF_SIZE * NUM_RX_DESC,
+                                                &tp->RxBufferDmas);

You don't want consistent mapping for the data buffer.
Either you pci_map_single() the whole kmalloced() area and you sync it
when needed or you turn this code into usual, per skb, pci_map_single()
calls and you remove the big Rx data buffer.

--
Ueimor

  reply	other threads:[~2003-11-05 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-05  7:46 r8169 with big-endian (patch) Alexandra N. Kossovsky
2003-11-05 18:34 ` Francois Romieu [this message]
2003-11-06 11:55   ` Alexandra N. Kossovsky

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=20031105193400.A12375@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=sasha@oktet.ru \
    --cc=shuchen@realtek.com.tw \
    /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).