netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manuel Perez Ayala <mperaya@alcazaba.unex.es>
To: netdev@oss.sgi.com
Subject: tg3 support broken on PPC, a workaround
Date: Tue, 10 May 2005 11:33:08 +0200	[thread overview]
Message-ID: <20050510113308.kbjo3ob1ck0404k8@158.49.151.11> (raw)

Hello,

Since linux kernel 2.6.8 the tg3 support was broken on my PPC machines (Power
Mac G4 silver) with data corruption.

After a while finally I've found the code responsible of my problems:

On debian kernel 2.6.8 in the tg3.c file, at line 7356 (inside the tg3_test_dma
function) there are a conditional piece of code that compiles only if the
platform is NOT 386:

#ifndef CONFIG_X86
        {
                u8 byte;
                int cacheline_size;
                pci_read_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, &byte);

                if (byte == 0)
                        cacheline_size = 1024;
                else
                        cacheline_size = (int) byte * 4;

                switch (cacheline_size) {
                case 16:
                case 32:
                case 64:
                case 128:
                        if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
                            !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) {
                                tp->dma_rwctrl |=
                                        DMA_RWCTRL_WRITE_BNDRY_384_PCIX;
                                break;
                        } else if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
                                tp->dma_rwctrl &=
                                        ~(DMA_RWCTRL_PCI_WRITE_CMD);
                                tp->dma_rwctrl |=
                                        DMA_RWCTRL_WRITE_BNDRY_128_PCIE;
                                break;
                        }
                        /* fallthrough */
                case 256:
                        if (!(tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
                            !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS))
                                tp->dma_rwctrl |=
                                        DMA_RWCTRL_WRITE_BNDRY_256;
                        else if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS))
                                tp->dma_rwctrl |=
                                        DMA_RWCTRL_WRITE_BNDRY_256_PCIX;
                };
        }
#endif


This has changed from version 2.6.7 (also Debian dist). At line 6964 (inside the
same function) was:

#ifndef CONFIG_X86
        {
                u8 byte;
                int cacheline_size;
                pci_read_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, &byte);

                if (byte == 0)
                        cacheline_size = 1024;
                else
                        cacheline_size = (int) byte * 4;

                tp->dma_rwctrl &= ~(DMA_RWCTRL_READ_BNDRY_MASK |
                                    DMA_RWCTRL_WRITE_BNDRY_MASK);

                switch (cacheline_size) {
                case 16:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_16 |
                                 DMA_RWCTRL_WRITE_BNDRY_16);
                        break;

                case 32:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_32 |
                                 DMA_RWCTRL_WRITE_BNDRY_32);
                        break;

                case 64:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_64 |
                                 DMA_RWCTRL_WRITE_BNDRY_64);
                        break;

                case 128:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_128 |
                                 DMA_RWCTRL_WRITE_BNDRY_128);
                        break;

                case 256:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_256 |
                                 DMA_RWCTRL_WRITE_BNDRY_256);
                        break;

                case 512:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_512 |
                                 DMA_RWCTRL_WRITE_BNDRY_512);
                        break;

                case 1024:
                        tp->dma_rwctrl |=
                                (DMA_RWCTRL_READ_BNDRY_1024 |
                                 DMA_RWCTRL_WRITE_BNDRY_1024);
                        break;
                };
        }
#endif


If I replace the 2.6.8 piece of code with the 2.6.7 one and compile the code, it
seems to work without problems of data corruption.

Perhaps is there a better solution adding or modifiyng only certain 2.6.8 code
to make the thinks works, but this works for me.

If anybody can sugest anything about it I will be very happy to try and report
anything about it.

Thanks.


----------
Manuel Perez Ayala
mperaya@alcazaba.unex.es
Facultad de Biblioteconomía y Documentación
Universidad de Extremadura

             reply	other threads:[~2005-05-10  9:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-10  9:33 Manuel Perez Ayala [this message]
2005-05-10 16:52 ` tg3 support broken on PPC, a workaround Michael Chan
2005-05-10 19:12   ` David S. Miller
2005-05-10 19:43     ` Michael Chan
2005-05-10 21:15       ` David S. Miller
2005-05-10 20:26     ` David S. Miller
2005-05-10 20:14       ` Michael Chan
2005-05-10 21:23         ` David S. Miller
2005-05-10 20:49           ` Michael Chan
2005-05-10 20:32       ` David S. Miller
2005-05-10 22:13     ` Rick Jones
2005-05-10 23:21       ` Grant Grundler
2005-05-10 23:36         ` David S. Miller
2005-05-11  6:04   ` Manuel Perez Ayala
2005-05-11 15:24     ` Michael Chan
2005-05-12  9:28       ` Manuel Perez Ayala
2005-05-12 16:33         ` Rick Jones
2005-05-12 18:06           ` Manuel Perez Ayala

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=20050510113308.kbjo3ob1ck0404k8@158.49.151.11 \
    --to=mperaya@alcazaba.unex.es \
    --cc=netdev@oss.sgi.com \
    /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).