jcdutton / linux-utilite

Linux kernel for the Compulab Utilite. http://www.compulab.co.il/utilite-computer/web/products. Use branch "linux-utilite"
Other
6 stars 1 forks source link

IGB Ethernet fails with "Invalid MAC Address" #4

Closed Cygon closed 5 years ago

Cygon commented 5 years ago

First, thank you very much for your work. My Utilite was collecting dust but it's still a very fine piece of hardware if only one can get a kernel running on it :)

I have checked out the v4.16.1-utilite branch (from 820c4160e53f3ed2e9d20727a3c68b1f9e9d1e9b) and am running it on my Utilite Pro.

The "fec" ethernet controller comes up fine, but the "igb" one does this:

igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
igb: Copyright (c) 1999-2006 Intel Corporation
igb 0000:01:00.0: enabling device (0140 -> 0142)
igb 0000:01:00.0: Invalid MAC Address

I noticed your im6q-cm-fx6.dts sets all MX6QDL_PAD_RGMII_* constants in the pinctrl_enet group to 0x1b030 whereas CompuLab used 0x1b0b0, but I wasn't able to find out where I could look up these adresses to make an informed decision. Changing them to be like CompuLab's original files doesn't seem to do anything.

Are there any extra steps required to make the Intel IGB ethernet adapter work?

Cygon commented 5 years ago

I tried hardcoding my Utilite's MAC address into the driver:

if (!is_valid_ether_addr(netdev->dev_addr)) {
    dev_err(&pdev->dev, "Invalid MAC Address\n");
    dev_err(&pdev->dev, "HACK: Using hardcoded MAC Address\n");
    u8 hardcoded_mac[6];
    hardcoded_mac[0] = 0x00;
    hardcoded_mac[1] = 0x01;
    hardcoded_mac[2] = 0xc0;
    hardcoded_mac[3] = 0x14;
    hardcoded_mac[4] = 0xc3;
    hardcoded_mac[5] = 0xe3;
    memcpy(netdev->dev_addr, hardcoded_mac, netdev->addr_len);
}

Which then allows the igb ethernet adapter to initialize and the net device to open:

igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
igb: Copyright (c) 2007-2014 Intel Corporation.
igb 0000:01:00.0: enabling device (0140 -> 0142)
igb 0000:01:00.0: Invalid MAC Address
igb 0000:01:00.0: HACK: Using hardcoded MAC Address
igb 0000:01:00.0: added PHC on eth1
igb 0000:01:00.0: Intel(R) Gigabit Ethernet Network Connection
igb 0000:01:00.0: eth1: (PCIe:2.5Gb/s:Width x1) 00:01:c0:14:c3:e3
igb 0000:01:00.0: eth1: PBA No: FFFFFF-0FF
igb 0000:01:00.0: Using MSI interrupts. 1 rx queue(s), 1 tx queue(s)

However (and I tried with both the 0x1b0b0 and 0x1b030 DTBs), I seem unable to actually send or receive any network packets with the IGB network adapter.

The /etc/init.d/net.eth1 device comes up successfully, is assigned an IP, can self-ping, but nothing goes over the wire.

jcdutton commented 5 years ago

The mac address is supposed to be put in the uboot config. uboot then inserts that into the device tree during the boot process. The NIC driver then finds it from the device tree. FYI. I have both NICs working here.

jcdutton commented 5 years ago

hexdump -C /sys/firmware/devicetree/base/soc/pcie@0x01000000/pcie@0,0/intel,i211@pcie0,0/local-mac-address That is where the MAC address should be after boot. My boot messages: [ 6.068730] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k [ 6.068739] igb: Copyright (c) 2007-2014 Intel Corporation. [ 6.068937] igb 0000:01:00.0: enabling device (0140 -> 0142) [ 6.343398] igb 0000:01:00.0: added PHC on eth1 [ 6.343406] igb 0000:01:00.0: Intel(R) Gigabit Ethernet Network Connection [ 6.343416] igb 0000:01:00.0: eth1: (PCIe:2.5Gb/s:Width x1) 00:01:c0:15:70:9d [ 6.343425] igb 0000:01:00.0: eth1: PBA No: FFFFFF-0FF [ 6.343434] igb 0000:01:00.0: Using MSI-X interrupts. 2 rx queue(s), 2 tx queue(s) [ 6.490132] igb 0000:01:00.0 enp1s0: renamed from eth1 [ 8.477068] igb 0000:01:00.0 enp1s0: igb: enp1s0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX

Cygon commented 5 years ago

Thanks. I've found your posts on the Intel Wired Ethernet Development list (http://patchwork.ozlabs.org/patch/890742/) and tried a bunch of the uboot settings variants from the CompuLab forums.

No luck so far, but I'm beginning to think I've got an entirely different problem (the network interface comes up, status LEDs are working, pinging its IP from the Utilite works, but not a single packet ever reaches the switch).

Your dmesg output says "Using MSI-X interrupts. 2 rx queue(s), 2 tx queue(s)" Mine says "Using MSI interrupts. 1 rx queue(s), 1 tx queue(s)"

For some reason, pci_enable_msix_range() in line 1149 of igb_main.c returns 0 (failure) and my igb drivers falls back to MSI interrupts. There seems to be a lot of things the igb driver does differently without MSI-X interrups, maybe CompuLab didn't test it that way.

jcdutton commented 5 years ago

I have uploaded some dtb files to try. https://github.com/jcdutton/linux-utilite/tree/v4.17.12-utilite/utilite I think your problem is down to the DTB file.

jcdutton commented 5 years ago

The MAC address is set via the environment. Please see the wiki page here: https://github.com/jcdutton/linux-utilite/wiki/uboot-environment