robbat2: (Default)

On one of my machines with a PCI-express Intel e1000 network controller, I get some weird behavior during startup. The driver loads, but the link lights are not lit until such time as I cycle the administrative link status. I did complain to the e1000 upstream folk about it months ago, but I still haven't seen a solution, as they seemed to bicker about it with Linus, in the name of power-saving.

The following is a snipped for /etc/conf.d/net that combines the solution with this problem with the more common check for link status check before trying to get a DHCP address.

check_link() {
  ethtool "${1}" | grep -q 'Link detected: yes'
}

preup() {
  # Try to force link up first, for e1000 special case
  i=0 
  while [ "${IFACE}" != "lo" ] && [ $i -lt 3 ] && ! check_link "${IFACE}"; do
    [ $i -gt 0 ] && sleep 1
    ip link set "${IFACE}" up  
    i=$(($i+1))
  done
  # Then check for actual link
  if ! check_link "${IFACE}"; then
    ewarn "No link on ${IFACE}, aborting configuration"
    ip link set "${IFACE}" down
    return 1
  fi  
}

May 2017

S M T W T F S
 123456
78910111213
141516171819 20
21222324252627
28293031   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags