nfe0 ping and dhclient problems

Sepherosa Ziehau sepherosa at gmail.com
Mon Jul 7 01:53:22 PDT 2008


On 7/7/08, Michael Neumann <mneumann at ntecs.de> wrote:
> > >
> >
> > Try
> > if_nfe.c rev 1.24
> > if_nfereg.h rev 1.6
> > if_nfevar.h rev 1.3
> >
>
>  No luck either! I can ping out, but not in, as before.
>
>  To rule out other possible problems, it works fine when booting from a
>  FreeBSD 7.0 cdrom.
>
>
> > Give me the output of 'ifconfig nfe0' and the dmesg, if possible.
> >
>
>  Here is pciconf, ifconfig and dmesg output:
>
>  $ pciconf -lv | grep -A4 '^nfe0'
>  nfe0 at pci0:10:0: class=0x020000 card=0x82b31043 chip=0x054c10de rev=0xa2
> hdr=0x00
>     vendor   = 'Nvidia Corp'
>     device   = 'MCP67 Ethernet'
>     class    = network
>     subclass = ethernet
>
>  $ ifconfig nfe0
>  nfe0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
>         options=8<VLAN_MTU>
>         ether 4f:ad:6d:c6:1f:00
>         media: Ethernet autoselect
>         status: active
>
>  $ dmesg | grep nfe0
>  nfe0: <NVIDIA MCP67 Gigabit Ethernet> port 0xc880-0xc887 mem
> 0xdfefe000-0xdfefe00f,0xdfefe400-0xdfefe4ff,0xdfefc000-0xdfefcfff
> irq 10 at device 10.0 on pci0
>  miibus1: <MII bus> on nfe0
>  nfe0: MAC address: 4f:ad:6d:c6:1f:00

Hehe, I see.  I wanted to change that code for a long time.  MCP61 and
above has different MAC address order.  Linux also added some code to
adjust TX_POLL, but it does not affect MCP61 and above.  Please test
the attached patch.

Best Regards,
sephe

-- 
Live Free or Die
? nfe_diff.txt
Index: if_nfe.c
===================================================================
RCS file: /dcvs/src/sys/dev/netif/nfe/if_nfe.c,v
retrieving revision 1.31
diff -u -p -r1.31 if_nfe.c
--- if_nfe.c	5 Jul 2008 07:29:44 -0000	1.31
+++ if_nfe.c	7 Jul 2008 08:50:15 -0000
@@ -373,7 +373,8 @@ nfe_probe(device_t dev)
 			case PCI_PRODUCT_NVIDIA_NFORCE_LAN:
 			case PCI_PRODUCT_NVIDIA_NFORCE2_LAN:
 			case PCI_PRODUCT_NVIDIA_NFORCE3_LAN1:
-				sc->sc_caps = NFE_NO_PWRCTL;
+				sc->sc_caps = NFE_NO_PWRCTL |
+					      NFE_FIX_EADDR;
 				break;
 			case PCI_PRODUCT_NVIDIA_NFORCE3_LAN2:
 			case PCI_PRODUCT_NVIDIA_NFORCE3_LAN3:
@@ -381,10 +382,13 @@ nfe_probe(device_t dev)
 			case PCI_PRODUCT_NVIDIA_NFORCE3_LAN5:
 				sc->sc_caps = NFE_JUMBO_SUP |
 					       NFE_HW_CSUM |
-					       NFE_NO_PWRCTL;
+					       NFE_NO_PWRCTL |
+					       NFE_FIX_EADDR;
 				break;
 			case PCI_PRODUCT_NVIDIA_MCP51_LAN1:
 			case PCI_PRODUCT_NVIDIA_MCP51_LAN2:
+				sc->sc_caps = NFE_FIX_EADDR;
+				/* FALL THROUGH */
 			case PCI_PRODUCT_NVIDIA_MCP61_LAN1:
 			case PCI_PRODUCT_NVIDIA_MCP61_LAN2:
 			case PCI_PRODUCT_NVIDIA_MCP61_LAN3:
@@ -397,7 +401,7 @@ nfe_probe(device_t dev)
 			case PCI_PRODUCT_NVIDIA_MCP73_LAN2:
 			case PCI_PRODUCT_NVIDIA_MCP73_LAN3:
 			case PCI_PRODUCT_NVIDIA_MCP73_LAN4:
-				sc->sc_caps = NFE_40BIT_ADDR;
+				sc->sc_caps |= NFE_40BIT_ADDR;
 				break;
 			case PCI_PRODUCT_NVIDIA_CK804_LAN1:
 			case PCI_PRODUCT_NVIDIA_CK804_LAN2:
@@ -406,7 +410,8 @@ nfe_probe(device_t dev)
 				sc->sc_caps = NFE_JUMBO_SUP |
 					       NFE_40BIT_ADDR |
 					       NFE_HW_CSUM |
-					       NFE_NO_PWRCTL;
+					       NFE_NO_PWRCTL |
+					       NFE_FIX_EADDR;
 				break;
 			case PCI_PRODUCT_NVIDIA_MCP65_LAN1:
 			case PCI_PRODUCT_NVIDIA_MCP65_LAN2:
@@ -420,7 +425,8 @@ nfe_probe(device_t dev)
 				sc->sc_caps = NFE_JUMBO_SUP |
 					       NFE_40BIT_ADDR |
 					       NFE_HW_CSUM |
-					       NFE_HW_VLAN;
+					       NFE_HW_VLAN |
+					       NFE_FIX_EADDR;
 				break;
 			case PCI_PRODUCT_NVIDIA_MCP77_LAN1:
 			case PCI_PRODUCT_NVIDIA_MCP77_LAN2:
@@ -2114,17 +2120,27 @@ done:
 static void
 nfe_get_macaddr(struct nfe_softc *sc, uint8_t *addr)
 {
-	uint32_t tmp;
+	uint32_t lo, hi;
+
+	lo = NFE_READ(sc, NFE_MACADDR_LO);
+	hi = NFE_READ(sc, NFE_MACADDR_HI);
+	if (sc->sc_caps & NFE_FIX_EADDR) {
+		addr[0] = (lo >> 8) & 0xff;
+		addr[1] = (lo & 0xff);
+
+		addr[2] = (hi >> 24) & 0xff;
+		addr[3] = (hi >> 16) & 0xff;
+		addr[4] = (hi >>  8) & 0xff;
+		addr[5] = (hi & 0xff);
+	} else {
+		addr[0] = (hi & 0xff);
+		addr[1] = (hi >>  8) & 0xff;
+		addr[2] = (hi >> 16) & 0xff;
+		addr[3] = (hi >> 24) & 0xff;
 
-	tmp = NFE_READ(sc, NFE_MACADDR_LO);
-	addr[0] = (tmp >> 8) & 0xff;
-	addr[1] = (tmp & 0xff);
-
-	tmp = NFE_READ(sc, NFE_MACADDR_HI);
-	addr[2] = (tmp >> 24) & 0xff;
-	addr[3] = (tmp >> 16) & 0xff;
-	addr[4] = (tmp >>  8) & 0xff;
-	addr[5] = (tmp & 0xff);
+		addr[4] = (lo & 0xff);
+		addr[5] = (lo >>  8) & 0xff;
+	}
 }
 
 static void
Index: if_nfevar.h
===================================================================
RCS file: /dcvs/src/sys/dev/netif/nfe/if_nfevar.h,v
retrieving revision 1.9
diff -u -p -r1.9 if_nfevar.h
--- if_nfevar.h	5 Jul 2008 07:29:44 -0000	1.9
+++ if_nfevar.h	7 Jul 2008 08:50:15 -0000
@@ -97,6 +97,7 @@ struct nfe_softc {
 #define NFE_40BIT_ADDR	0x02
 #define NFE_HW_CSUM	0x04
 #define NFE_HW_VLAN	0x08
+#define NFE_FIX_EADDR	0x10
 #define NFE_NO_PWRCTL	0x20
 
 	uint32_t		sc_flags;




More information about the Bugs mailing list