# tg3: dhcp timeout at boot time

## kettuz

Hello!

I'm having an odd problem with my tg3 based network adapter in my Acer Aspire 7730G. 

At the boot time the driver is loaded, but when the dhcpcd tries to get an ip address, it times out. 

What's however rather curious, is that after giving manually the commands

```
# ifconfig eth0 up

# /etc/init.d/net.eth0 start
```

the dhcp is able to get an address. This doesn't happen if the adapter isn't first manually activated through ifconfig or if the second command is issued instantly after it.

Any ideas, where to start looking?

----------

## audiodef

What kernel driver are you using, and is it compiled-in or loaded as a module?

----------

## d2_racing

Hi, can you post this :

```

# emerge --info

# rc-update show

# cat /etc/conf.d/net

```

----------

## arnelj

I do also have the same problem.

I have tried both compiled in and loaded modules.

lcpci -v gives

```
05:02.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5782 Gigabit Ethernet (rev 03)

        Subsystem: Hewlett-Packard Company d530 CMT (DG746A)

        Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 20

        Memory at fc500000 (64-bit, non-prefetchable) [size=64K]

        Expansion ROM at <ignored> [disabled]

        Capabilities: [48] Power Management version 2

        Capabilities: [50] Vital Product Data

        Capabilities: [58] MSI: Enable- Count=1/8 Maskable- 64bit+

        Kernel driver in use: tg3

```

 my rc-update show gives

```
linux ~ # rc-update show 

           alsasound | boot                          

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

                hald |      default                  

            hostname | boot                          

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

              net.lo | boot                          

           rmnologin | boot                          

           syslog-ng |      default                  

      udev-postmount |      default                  

             urandom | boot                          

          vixie-cron |      default                  

                 xdm |      default 
```

my cat /etc/conf.d/net gives

```
linux ~ # cat /etc/conf.d/net 

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

#config_eth0=( "dhcp" )

#dhcp_eth0="nodns"

```

my emerge --info gives

```
linux ~ # emerge --info 

Portage 2.1.8.3 (default/linux/x86/10.0/desktop/kde, gcc-4.4.3, glibc-2.11.2-r0, 2.6.35-gentoo-r5 i686)

=================================================================

System uname: Linux-2.6.35-gentoo-r5-i686-Intel-R-_Pentium-R-_4_CPU_3.00GHz-with-gentoo-1.12.13

Timestamp of tree: Thu, 02 Sep 2010 18:00:22 +0000

app-shells/bash:     4.0_p37

dev-lang/python:     2.6.5-r3, 3.1.2-r4

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 1.12.13

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.65

sys-devel/automake:  1.9.6-r3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.4.3-r2

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6b

sys-devel/make:      3.81-r2

virtual/os-headers:  2.6.30-r1

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="* -@EULA"

CBUILD="i486-pc-linux-gnu"

CFLAGS="-O2 -march=i486 -pipe"

CHOST="i486-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -march=i486 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://ftp.df.lth.se/pub/gentoo/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa berkdb bluetooth branding bzip2 cairo cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif gpm gtk hal iconv ipv6 jpeg kde lcms ldap libnotify mad mikmod mng modules mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png ppds pppd python qt3support qt4 readline reflection sdl server session spell spl ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis x264 x86 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

----------

## kettuz

Using module at the moment, have tried compiling it to kernel.

lspci -v

```

09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5764M Gigabit Ethernet PCIe (rev 10)

   Subsystem: Acer Incorporated [ALI] Device 0142

   Flags: bus master, fast devsel, latency 0, IRQ 48

   Memory at c0c00000 (64-bit, non-prefetchable) [size=64K]

   Capabilities: [48] Power Management version 3

   Capabilities: [40] Vital Product Data

   Capabilities: [60] Vendor Specific Information <?>

   Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+

   Capabilities: [cc] Express Endpoint, MSI 00

   Capabilities: [100] Advanced Error Reporting

   Capabilities: [13c] Virtual Channel <?>

   Capabilities: [160] Device Serial Number 00-1e-68-ff-fe-a2-21-70

   Capabilities: [16c] Power Budgeting <?>

   Kernel driver in use: tg3

   Kernel modules: tg3

```

rc-update show

```
           alsasound |      default                  

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

          fbcondecor | boot                          

                hald |      default                  

            hostname | boot                          

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

              net.lo | boot                          

           rmnologin | boot                          

           syslog-ng |      default                  

      udev-postmount |      default                  

             urandom | boot                          

          vixie-cron |      default         

```

cat /etc/conf.d/net

```
# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

```

emerge --info

```
Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.35.2 x86_64)

=================================================================

System uname: Linux-2.6.35.2-x86_64-Intel-R-_Core-TM-2_Duo_CPU_P7350_@_2.00GHz-with-gentoo-1.12.13

Timestamp of tree: Thu, 02 Sep 2010 10:45:01 +0000

app-shells/bash:     4.0_p37

dev-java/java-config: 2.1.11

dev-lang/python:     2.6.5-r3, 3.1.2-r4

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 1.12.13

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.65

sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.4.3-r2

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6b

sys-devel/make:      3.81-r2

virtual/os-headers:  2.6.30-r1

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core2 -mtune=generic -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"

CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/ ftp://trumpetti.atm.tut.fi/gentoo/ "

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="X a52 aac aalib acl afterimage alsa amd64 amr apm arts avi berkdb bzip2 cairo cddb cdparanoia cdr cli cracklib crypt cups cxx dbus dri dts dv dvd dvdread encode fbcondecor firefox flac fluidsynth foomaticdb fortran gdbm gif gpm gtk gtk2 hal hddtemp iconv icq iee1394 imlib indent ipv6 jack jbig jpeg jpeg2k libac3 libcaca libg++ libsamplerate libwww mad matroska mikmod mjpeg mmx modules motif mp2 mp3 mpeg msn mudflap multilib ncurses nls nptl nptlonly nsplugin ogg oggtheora oggvorbis opengl openmp oss pam pcre pdflib perl png ppds pppd python qt qt3support quicktime readline reflection sdl session slang spell spl sse sse2 ssl svg sysfs tcpd theora threads tiff timidity truetype unicode v4l v4l2 vorbis wmv x264 xml2 xorg xv xvid yahoo zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia vesa fbdev nv" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

----------

## chithanh

As workaround, you can insert an ifconfig call in preup()

```
preup() {

        ifconfig "${IFACE}" 0.0.0.0 up

        return 0

}

```

(use net.eth0 instead of net to make this apply only to eth0)

----------

## arnelj

Thank you for putting me in the right direction.

If I add a delay of 3 sec in the preup command, then my ethernet card could start as it should.

My /etc/conf.d/net.eth0 file now looks like this

```
preup() {

        ifconfig "${IFACE}" 0.0.0.0 up

        sleep 3s

        return 0

}
```

two second delay was not enough

----------

## d2_racing

Hi, it's normal that you don't have any ip once you boot.

You need this :

```

# cd /etc/init.d

# ln -s net.lo net.eth0

# rc-update add net.eth0 default

```

Now reboot your box and try again  :Razz: 

----------

## arnelj

Hi, I agree,

that was the fist thing I tried, and that it the way it should be done

The problem is that the Broadcom network adapter with the tg3 driver doesn't start with that setup.

If you load the modules by hand (broadcom and then tg3) and then execute /etc/init.d/net.eth0 start, then the adapter work as it should.

It seams that the adapter need about 3 seconds after loading the modules before the next command otherwise the eth0 interface disappears and you have to use the command ifconfig eth0 up to get it back.

----------

## kettuz

 *arnelj wrote:*   

> Thank you for putting me in the right direction.
> 
> If I add a delay of 3 sec in the preup command, then my ethernet card could start as it should.
> 
> My /etc/conf.d/net.eth0 file now looks like this
> ...

 

Doing this fixes the problem at my end too.

----------

## d2_racing

Weird bug indeed.

----------

## HTS

Same problem, same workaround fixes it.

Still happening in 2.6.36-gentoo-r1.

Only bug I found which might be related:

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

Resolution marked as upstream but no link to the upstream bug.

Hopefully a fix soon but I expect many users with tg3 will hit this when they upgrade to 2.6.35+

----------

## HTS

Fixed in 2.6.37!

----------

