Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by tsdnz »

Hi everyone, I must have missed something, my Ethernet driver works in VirtualBox, but not on hardware.
Device 100E
Vendor 8086
Does anyone have some code for me to compare?
I am after the init & reset code.
Not worried about setting up buffers or OS specific code.

Thanks, Alistair
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by SpyderTL »

Can you be a little more specific?

What doesn't work? What network card do you have in your physical PC? An actual Intel PRO 1000 MT?

Do you actually have the exact same PCI network vendor/device ID in both VirtualBox and in your physical machine?
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by tsdnz »

Can you be a little more specific?

What doesn't work? What network card do you have in your physical PC? An actual Intel PRO 1000 MT?

Do you actually have the exact same PCI network vendor/device ID in both VirtualBox and in your physical machine?
Yes the same vendor/deviceID = 8086/100E

My OS is showing a list of interrupts with performance counters (Automatically done, no issues here).
The Ethernet interrupt is not firing on hardware.

Here is my code for IOAPIC write for the interrupt

Code: Select all

		// Grab the IRQ of the device
		EthernetCardDetails.IRQ = EthernetCardDetails.PCI_ReadUsingDWORD(EthernetCardDetails.PCIAddress + (0xF << 2));
		ABIT.IOAPICs->EntryWrite(0, EthernetCardDetails.IRQ, EthernetInterrupt, tIOAPIC::DeliveryMode::Fixed, tIOAPIC::DestinationMode::Physical, tIOAPIC::PinPolarity::ActiveHigh, tIOAPIC::TriggerMode::Edge, false, CPU->APICID);
This is the function header.

Code: Select all

FIL void EntryWrite(DWORD iIOAPIC, DWORD Register, BYTE Vector, tIOAPIC::DeliveryMode deliverymode, tIOAPIC::DestinationMode destinationmode, tIOAPIC::PinPolarity pinpolarity, tIOAPIC::TriggerMode triggermode, bool Mask, BYTE CPU)
I think the card is not setup correctly.
I have the "pci-pci-x-family-gbe-controllers-software-dev-manual.pdf" file.
I have been going through this this morning, need a break (pizza), and back into it.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by SpyderTL »

I can't help you with the IOAPIC stuff. That's a bit beyond my expertise level, but maybe I can throw out some troubleshooting ideas.

I'm assuming the Intel 1000 has a flag showing that an interrupt was fired. Have you checked this? This will let you know whether the problem is on the device side (not setup correctly) or the OS side (IRQs/APIC not setup correctly).
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by tsdnz »

I'm assuming the Intel 1000 has a flag showing that an interrupt was fired. Have you checked this? This will let you know whether the problem is on the device side (not setup correctly) or the OS side (IRQs/APIC not setup correctly).
Yes, it has a flag and it is not set, the interrupt is not getting generated.
The packets are getting received, as shown in the Statistics Counters.
Last night I wrote code to display all the registers and their values.
Today I will check this against the Virtual Machine and check the documentation to see what the values / bits mean.
I will check the order of the instructions and make sure I have not inserted a "Read" that will clear the interrupt.

Edit: It is showing LinkUp in the bits, but no interrupt is fired

Thanks for your help.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by SpyderTL »

I assume your physical PC isn't using PCI-X... and that your network card doesn't "think" it's using PCI-X. (Register 0x0008 Bit 13)

I'm looking through the Intel Software Developers Manual, and I'm looking at the Interrupt Cause Read register (0x00c0), and I'm not seeing any packet received interrupt. The closest I see is a Receive Descriptor Minimum Threshold Reached flag (Bit 4). The Minimum Threshold is located in the Receive Control Register (0x0100 Bits 8-9), and specifies the "fraction" of the RDLEN size (0x2808) that triggers an interrupt (0 = 1/2 (default), 1 = 1/4, 2 = 1/8).

So, if I'm reading this correctly, if you have 16 entries in your Receive Buffer, you won't get an interrupt until you've received 8 packets (by default).

Also, make sure this interrupt isn't disabled (0x00d0 Bit 4).

You probably know all of this already, but I'm just getting it down, so that I can find it later, when I decide to add support for these network cards to my project.

EDIT: Just noticed that RDLEN is multiplied by 8, and must be at 128-byte aligned, so the minimum value would be 8 (which would be 0x0001, shifted left 7 bits, or 0x0080 in the RDLEN register, if my math is correct). If you set the Threshold to 1/8th, then you should get an interrupt on every packet...
Last edited by SpyderTL on Mon Sep 15, 2014 2:37 pm, edited 1 time in total.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by tsdnz »

Thanks, just found that it sends a Transmit Queue Empty Interrupt when first enabled.

ICR (000C0H; R) Bit 1 TXQE

Just about to drop daughter off at school, will be back to check out what is happening.
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Re: Ethernet Init & Reset - Intel PRO/1000 MT Desktop

Post by tsdnz »

Figured it out, there was nothing wrong.
The Ethernet card is firing interrupt 0x14, the PCI shows 0x0B.
I had IO APIC disabled for 0x14, so no interrupt was sent.
I will start another thread to find out how to get the correct IRQ
Post Reply