# LAN driver for ASUS P5G41-M LE/CSM



## penna (Nov 2, 2010)

Hi,

I have installed FreeBSD 8.1-RELEASE on my newly assembled computer. The default LAN driver (ale) does not seem to work. It is detected initially during the system startup then it is turned down by the system. The Motherboard (ASUS P5G41-M LE/CSM) details are on the following link:

http://commercial.asus.com/product/detail/18

The link describes that the LAN is "Gb Atheros PCIe" which fits the description given in man pages ale(4), age(4) and alc(4). I don't know which one to use. Is there a way to find out the chip number (AR 8???)? I have looked at the manual for the motherboard also without any success.


----------



## wblock@ (Nov 2, 2010)

`% pciconf -lv | grep -B3 network`


----------



## penna (Nov 3, 2010)

```
# pciconf -lv | grep -B3 network
ale0@pci0:1:0:0                class=0x020000 card=0x83041043 chip=0x10261969 rev=0xb0 hdr=0x00
     vendor   = 'Attansic (Now owned by Atheros)'
     device   = 'PCI-E ETHERNET CONTROLLER (AR8121/AR8113 )'
     class    = network
```


----------



## penna (Nov 3, 2010)

Output of `dmesg | grep ale0`


```
ale0: <Atheros AR8121/AR8113/AR8114 PCIe Ethernet> port 0xce00-0xce7f mem 0xfebc0000-0xfebfffff irq 17 at device 0.0 on pci1
ale0: 960 Tx FIFO, 1024 Rx FIFO
ale0: Using 1 MSI messages.
ale0: 4GB boundary crossed, switching to 32bit DMA addressing mode.
miibus0: <MII bus> on ale0
ale0: Ethernet address: 48:5b:39:94:b2:16
ale0: [FILTER]
```

I do not understand what is wrong!


----------



## wblock@ (Nov 3, 2010)

penna said:
			
		

> Output of `dmesg | grep ale0`
> 
> 
> ```
> ...



Given what's been shown, maybe nothing is wrong.  What does ifconfig(8) show?  How do you configure the card in /etc/rc.conf?


----------



## DutchDaemon (Nov 3, 2010)

penna, *format your posts*!


----------



## penna (Nov 3, 2010)

wblock said:
			
		

> Given what's been shown, maybe nothing is wrong.  What does ifconfig(8) show?  How do you configure the card in /etc/rc.conf?



output of ifconfig (related to ale0)


```
ale0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c319a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,
WOL_MAGIC,VLAN_HWTSO,LINKSTATE>
        ether 48:5b:39:94:b2:16
        media: Ethernet autoselect (none)
        status: no carrier
```

configuration in /etc/rc.conf


```
defaultrouter="192.168.1.1"
hostname="example"
if_ale0="dhcp"
```


----------



## penna (Nov 3, 2010)

DutchDaemon said:
			
		

> penna, *format your posts*!



sure.


----------



## wblock@ (Nov 3, 2010)

penna said:
			
		

> output of ifconfig (related to ale0)
> 
> ```
> ale0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
> ...



It's not detecting your cable.  Try another cable first, then try manually setting the mediatype to match whatever your switch is expecting.


----------



## penna (Nov 4, 2010)

wblock said:
			
		

> It's not detecting your cable.  Try another cable first, then try manually setting the mediatype to match whatever your switch is expecting.



I tried 2-3 different cables without any success. Although I guess it is not the cable problem. As I mentioned above, the cable is detected during the startup but then the interface is turned down.
However, I tried to manually set the media type using the following commands:
`# ifconfig ale0 media 10baseT/UTP up`
`# dhclient ale0`
`# ifconfig ale0`

```
ale0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c319a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,WOL_MAGIC,VLAN_HWTSO,LINKSTATE>
        ether 48:5b:39:94:b2:16
        inet 192.168.1.71 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet 10baseT/UTP (10baseT/UTP <half-duplex>)
        status: active
```
`# ping [url]http://www.google.com[/url]`

```
PING www.l.google.com (72.14.204.103): 56 data bytes
64 bytes from 72.14.204.103: icmp_seq=2 ttl=55 time=43.804 ms
64 bytes from 72.14.204.103: icmp_seq=3 ttl=55 time=43.383 ms
64 bytes from 72.14.204.103: icmp_seq=5 ttl=55 time=46.348 ms
64 bytes from 72.14.204.103: icmp_seq=6 ttl=55 time=45.611 ms
64 bytes from 72.14.204.103: icmp_seq=7 ttl=55 time=45.296 ms
^C
--- www.l.google.com ping statistics ---
8 packets transmitted, 5 packets received, 37.5% packet loss
round-trip min/avg/max/stddev = 43.383/44.888/46.348/1.119 ms
```
It seems that the network is active now! However please note the 37.5% packet loss. Also, I am almost certain that this is not a gigabit connection. I don't know how to find out though.


----------



## wblock@ (Nov 4, 2010)

penna said:
			
		

> However, I tried to manually set the media type using the following commands:
> `# ifconfig ale0 media 10baseT/UTP up`
> `# dhclient ale0`
> `# ifconfig ale0`
> ...



It's only 10 megabit that way.  Remember that gigabit is touchier about everything, including cables and switch.  Try avoiding autoconfig by setting the media to 1000baseTX.  If that works, your switch might be the problem.  The driver might not be quite right for that card; creating a PR or posting to the freebsd-net mailing list is the next step.


----------



## penna (Nov 5, 2010)

wblock said:
			
		

> It's only 10 megabit that way.  Remember that gigabit is touchier about everything, including cables and switch.  Try avoiding autoconfig by setting the media to 1000baseTX.  If that works, your switch might be the problem.  The driver might not be quite right for that card; creating a PR or posting to the freebsd-net mailing list is the next step.


Added the following lines in /etc/rc.conf and rebooted the system.

```
ifconfig_ale0="DHCP"
ifconfig_ale0="media 1000baseTX"
```
`# ifconfig ale0`

```
ale0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c319a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,WOL_MAGIC,VLAN_HWTSO,LINKSTATE>
        ether 48:5b:39:94:b2:16
        inet 192.168.1.71 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
```
Note that the system defaults to "100baseTX <full-duplex>". Maybe my router does not support gigabit connection. I will try putting a network switch (in between) that can negotiate Fast Ethernet connection with the router and Gigabit connection with the computer.
Another problem is that I have to run `# dhclient ale0` in order to get the IP address above. Is it possible to do it from /etc/rc.conf automatically?


----------



## wblock@ (Nov 5, 2010)

penna said:
			
		

> Added the following lines in /etc/rc.conf and rebooted the system.
> 
> ```
> ifconfig_ale0="DHCP"
> ...



That won't work.  Those lines above are just a value assignment, not code.  The first sets the value to DHCP, then the second immediately overwrites it with the media setting.  To do both, they have to be combined:


```
ifconfig_ale0="DHCP media 1000baseTX"
```

Also, SYNCDHCP is often better for normal use.


----------



## penna (Nov 5, 2010)

wblock said:
			
		

> ...
> 
> ```
> ifconfig_ale0="DHCP media 1000baseTX"
> ...



That worked! Thanks. I will update this post after I experiment with the Gb network switch.


----------



## penna (Nov 19, 2010)

penna said:
			
		

> That worked! Thanks. I will update this post after I experiment with the Gb network switch.


Finally, I was able to do the experiment with the Gigabit switch. I placed the gigabit switch between the router and the computer (running FreeBSD). The following (which I mentioned in the beginning of this thread) problem disappeared.


			
				penna said:
			
		

> It is detected initially during the system startup then it is turned down by the system.


 My /etc/rc.conf has the following settings now:

```
if_ale0="DHCP"
```
 Note that I have removed the media type.`# ifconfig ale0`

```
ale0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=c319a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,WOL_MAGIC,VLAN_HWTSO,LINKSTATE>
	ether 48:5b:39:94:b2:16
	inet 192.168.1.71 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
```
Note that the gigabit connection is automatically detected.
`# ping -c 5 [url]http://www.google.com[/url]`

```
PING www.google.com (72.14.204.103): 56 data bytes
64 bytes from 72.14.204.103: icmp_seq=0 ttl=55 time=44.392 ms
64 bytes from 72.14.204.103: icmp_seq=1 ttl=55 time=44.619 ms
64 bytes from 72.14.204.103: icmp_seq=2 ttl=55 time=42.977 ms
64 bytes from 72.14.204.103: icmp_seq=3 ttl=55 time=44.121 ms
64 bytes from 72.14.204.103: icmp_seq=4 ttl=55 time=42.583 ms

--- www.google.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 42.583/43.738/44.619/0.808 ms
```

Turns out that the router was the culprit and not the default driver installed by FreeBSD for my onboard network card.


----------

