# [Solved] Realtek 8168 does not compile with kernel 2.6.17

## kwisatz_haderais

I've been using the drivers from the realtek website [url]http://www.realtek.com.tw/downloads/downloads1-3.aspx?keyword=8168#2004111Unix%20(Linux)[/url] (the r8169 won't work for me) with the 2.6.16-r12 gentoo-sources.

Recently I compiled gentoo-sources-2.6.17-r2, now I'm getting the following error:

 *Quote:*   

> /mnt/stick/r1000/src/r1000_n.c:46: error: syntax error before string constant
> 
> /mnt/stick/r1000/src/r1000_n.c:46: warning: type defaults to `int' in declaration of `MODULE_PARM'
> 
> /mnt/stick/r1000/src/r1000_n.c:46: warning: function declaration isn't a prototype
> ...

 

here's what that file looks like around line 46:

 *Quote:*   

>  43 MODULE_DEVICE_TABLE (pci, r1000_pci_tbl);
> 
>      44 MODULE_AUTHOR ("Realtek");
> 
>      45 MODULE_DESCRIPTION ("Linux device driver for Realtek Ethernet Controllers");
> ...

 

I don't really have any idea what this means, so I'd be very happy if somebody could have a look at it.

P.S.: someone has already asked for an ebuild here: https://bugs.gentoo.org/show_bug.cgi?id=129216Last edited by kwisatz_haderais on Tue Jul 18, 2006 9:48 pm; edited 1 time in total

----------

## wynn

This isn't going to help very much but the way of describing the module parameters has changed with 2.6.17. This article http://lwn.net/Articles/107303/ from October 2004 says that a patch was posted marking it obsolete.

RealTek is not the only late one, though: http://www.handhelds.org/hypermail/oe-commits/61/6183.html

 *Quote:*   

> From: rwhitby commit <oe-commits_at_handhelds.org>
> 
> Date: Tue, 20 Jun 2006 07:20:47 +0200 (CEST)
> 
> ixp4xx, ixp425-eth: Updated for 2.6.17 kernel (MODULE_PARM now removed) 
> ...

 

r1000_n.c (aka RTL6168B) has

```
MODULE_AUTHOR ("Realtek");

MODULE_DESCRIPTION ("Linux device driver for Realtek Ethernet Controllers");

MODULE_PARM (media, "1-" __MODULE_STRING(MAX_UNITS) "i");
```

and r8169.c from 2.6.17-gentoo-r2/drivers/net has

```
MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>")

MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver");

module_param_array(media, int, &num_media, 0);

MODULE_PARM_DESC(media, "force phy operation. Deprecated by ethtool (8).");

module_param(rx_copybreak, int, 0);

MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");

module_param(use_dac, int, 0);

MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot.");

module_param_named(debug, debug.msg_enable, int, 0);

MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)");
```

There doesn't seem to be enough information (for me at least) to see how to change r1000 so it means waiting on RealTek.

----------

## kwisatz_haderais

I'd help me if I were into kernel hacking  :Wink: 

I appreciate your help though!

I submitted an ebuild for the driver... (not a very good one though)

https://bugs.gentoo.org/show_bug.cgi?id=129216

----------

## kwisatz_haderais

http://www.mail-archive.com/netdev@vger.kernel.org/msg13809.html

does this mean, support should have been merged into the kernel driver or not? I don't quite get it.

Nevertheless, the r8169 (still) doesn't work for me, so I guess no.

----------

## wynn

 *Quote:*   

> http://www.mail-archive.com/netdev@vger.kernel.org/msg13809.html
> 
> does this mean, support should have been merged into the kernel driver or not?

 

From the message pointed at by the URL above

 *Quote:*   

> add several PCI ID for the PCI-E adapters

  From what I could see, the r1000 is a PCI-E version of the r8169 so it may be in a kernel. However, the kernel being talked about is (presumably) now available as 2.6.17-gentoo-r{1,2,3} but drivers/net/r8169.c shows no sign of it. The pci_device_id table (which is one of the things patched) is

```
static struct pci_device_id rtl8169_pci_tbl[] = {

        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8169), },

        { PCI_DEVICE(PCI_VENDOR_ID_DLINK,       0x4300), },

        { PCI_DEVICE(0x16ec,                    0x0116), },

        { PCI_VENDOR_ID_LINKSYS,                0x1032, PCI_ANY_ID, 0x0024, },

        {0,},

};
```

 but, in the patch submitted, it should be

```
 static struct pci_device_id rtl8169_pci_tbl[] = {

       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8136), 0, 0, 2 },

       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8167), 0, 0, 2 },

       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8168), 0, 0, 2 },

       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8169), 0, 0, 1 },

       { PCI_DEVICE(PCI_VENDOR_ID_DLINK,       0x4300), 0, 0, 1 },

       { PCI_DEVICE(0x16ec,                    0x0116), 0, 0, 1 },

       { PCI_VENDOR_ID_LINKSYS,                0x1032,

               PCI_ANY_ID, 0x0024, 0, 0, 1 },

        {0,},

 };
```

 I believe we can safely conclude that the patch is not in the current 2.6.17-gentoo-r3.

Of course, you can always apply the patch yourself   :Very Happy: 

----------

## kwisatz_haderais

 *wynn wrote:*   

> Of course, you can always apply the patch yourself  

 

I was thinking of that. Guess I'll give it a try when I'm at home later.

Thanks again for your advice.

----------

## wynn

 *Quote:*   

> Of course, you can always apply the patch yourself

  Sorry to spoil your surprise: linux-2.6.17-gentoo-r3/drivers/net/r8169.c patched using the copies from http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.17-rc6/r8169

The files are

```
0001-r8169-mac-address-change-support.txt

0002-r8169-RX-fifo-overflow-recovery.txt

0003-r8169-hardware-flow-control.txt

0004-r8169-remove-rtl8169_init_board.txt

0005-r8169-sync-with-vendor-s-driver.txt
```

 He says that 0001- is only for review, I was going to omit it but didn't realize it was the first. Kernel recompiled and installed and now running: there's only an r8169 here so it's not a proper test.

The email you quoted said they were patches against 2.6.17-rc6 â after a time I realized that this meant they would not be in 2.6.17 but in 2.6.18. If you download patch-2.6.18-rc2.bz2 from kernel.org, you will find the patch included but it is missing the "mac address change support" patch I think.

----------

## kwisatz_haderais

 *wynn wrote:*   

> The email you quoted said they were patches against 2.6.17-rc6 â after a time I realized that this meant they would not be in 2.6.17 but in 2.6.18. If you download patch-2.6.18-rc2.bz2 from kernel.org, you will find the patch included but it is missing the "mac address change support" patch I think.

 

Oh well, I thought release candidates were pre-stable versions... 

Actually, you didnt't really spoil my surprise with your 8169  :Wink: 

Getting it to work would be the last step for my MSI S262 to be supported completely...

----------

## kwisatz_haderais

ok... this made me utterly curious, guess I'll be driving home now  :Wink: 

----------

## kwisatz_haderais

argh, damn it!

The driver loads, even recognizes my link status (up/down) but I can't get a dhcp lease. (which was no a problem at all using the r1000 and 2.6.16)  :Sad: 

I sent an email to francois romieu

----------

## kwisatz_haderais

 *francois romieu wrote:*   

> How does the patched driver behave if you replace NET_IP_ALIGN by the
> 
> value "8" in drivers/net/r8169.c ?
> 
> 

 

nice!  :Wink: 

----------

## juangamnik

 *kwisatz_haderais wrote:*   

> Getting it to work would be the last step for my MSI S262 to be supported completely...

 

I have the MSI S262, too. Could you tell me how you solved your problems?

Does that mean ACPI and suspending resuming works for you? For me it does shutdown CPU1 but not CPU0 sometimes and the system does not shut down. Even a halt doesn't work then anymore. Some times (not very frequently) it shuts down, returns but can't load X screen anymore, it remains black. Switching of dri in xorg.conf reduces the error frequency two every 5 or 6 times of suspending (I'm using suspend2-2.6.17).

Will the 8169 module support the r1000 or r8168 (lspci) with the 2.6.18? What did you do about the Graphics module and the Wireless lan module. For the wireless lan I use the ipw3945 ebuild and it doesn't seem to be supported in 2.6.17 even though in http://www.michael-prokop.at/blog/ it is mentioned that the 2.6.17 kernel has support for ipw3945 with the ebuild ipw3945-ucode...

For my suspend problem there are more infos here: https://forums.gentoo.org/viewtopic-t-482112-highlight-suspend2.html

----------

## kwisatz_haderais

 *juangamnik wrote:*   

> 
> 
> Does that mean ACPI and suspending resuming works for you?

 

Well, I don't use supend @ all, I've never even tried to, so I cannot help you there, sorry.

 *juangamnik wrote:*   

> Will the 8169 module support the r1000 or r8168 (lspci) with the 2.6.18?

 

Most probably, yes. You may want to patch your 2.6.17 kernel with the patches mentioned above, it works like a charm.

 *juangamnik wrote:*   

> What did you do about the Graphics module and the Wireless lan module. For the wireless lan I use the ipw3945 ebuild and it doesn't seem to be supported in 2.6.17 even though in http://www.michael-prokop.at/blog/ it is mentioned that the 2.6.17 kernel has support for ipw3945 with the ebuild ipw3945-ucode...

 

my ipw3945 works like a charm as well. Have you made sure your wlan switch is turned on? (press once)

What's the matter with the graphics module? The driver supplied by xorg-x11 - using the ~x86 xorg-server - works for me.

----------

## juangamnik

 *Quote:*   

> my ipw3945 works like a charm as well.

 

Mine, too. But I use the ipw3945 ebuild which has to be reemerged after every kernel-compile. So I was curious if it is supported by the kernel,yet?!?

 *Quote:*   

> Most probably, yes. You may want to patch your 2.6.17 kernel with the patches mentioned above, it works like a charm. 

 

Could you give me a little advice how (code/shell snipplet)? There was something with changing a littlebit in 8169.ko afterwards... (you wrote something about a mail...)

I had another workaround. I commented out the moduleparameter but then I get a bug in my dmesg, but it works at all.

 *Quote:*   

> Well, I don't use supend @ all, I've never even tried to, so I cannot help you there, sorry.

 

You don't use suspend modes at all or not suspend2? If you got it working another way, please tell me.

Another question: Do you know how to catch and handle acpi events?

----------

## kwisatz_haderais

 *juangamnik wrote:*   

> Mine, too. But I use the ipw3945 ebuild which has to be reemerged after every kernel-compile. So I was curious if it is supported by the kernel,yet?!?

 

Don't think so, that's the bcm43xx driver you're thinking of, I guess.

 *juangamnik wrote:*   

> You don't use suspend modes at all or not suspend2? If you got it working another way, please tell me.

 

Not at all  :Smile:  Do I need that? Or rather: Is it really useful?

 *juangamnik wrote:*   

> Another question: Do you know how to catch and handle acpi events?

 

Nope, sorry

----------

## kwisatz_haderais

I guess you already had a look @ this article: http://www.gentoo.org/doc/en/power-management-guide.xml ?

Concerning Suspend2, can you explain in your own words what the advantages of using supend over simply shutting down the machine are?

Maybe I'd like to use it, I've only never considered it until now.

----------

## TheS4int

how can i apply the patches, and where are the patches?

iam using 2.6.17-r4, can i apply the patches anyway?

at this address are only txt files http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.17-rc6/r8169

how can i use this, if thats relevant for me.

----------

## kwisatz_haderais

those "txt" files are the patches

```
man patch
```

see also: https://forums.gentoo.org/viewtopic-t-486635-highlight-r8169.html

----------

## Paapaa

It seems that the r8169 patch (adding support for RTL 8168/8111) is in mm-tree:

http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.18-rc6/2.6.18-rc6-mm1/announce.txt

http://www.kernel.org/diff/diffview.cgi?file=%2Fpub%2Flinux%2Fkernel%2Fpeople%2Fakpm%2Fpatches%2F2.6%2F2.6.18-rc6%2F2.6.18-rc6-mm1%2F2.6.18-rc6-mm1.bz2;z=1693

Don't know if it'll be in 2.6.18, but let's hope so. (I also might need the support in the near future...)

----------

## all-inc.

If someone is still interested in the built-in support for 8168 chips, and its actual status, have a look at this bug.

cheers sebastian

----------

## Paapaa

It also seems that the support will go into the next stable release: 2.6.18.1.

----------

## all-inc.

yes, that's the reason why i wrote the previous post.

(Quote from the link in my previous post)

 *Quote:*   

> This will be fixed as of gentoo-sources-2.6.18-r1

 

----------

