Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel: New IO mapped Register API and a rework of the E1000 drivers #25521

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Hendiadyoin1
Copy link
Contributor

Less defines, more type safety....

Kernel/Net/Intel/E1000NetworkAdapter.cpp Outdated Show resolved Hide resolved
Kernel/Net/Intel/E1000NetworkAdapter.cpp Outdated Show resolved Hide resolved
Comment on lines +357 to +782
// FIXME: This seems odd to me:
// We disable interrupts and then wait for and irq to happen...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a long shot, but I feel like this tries to avoid getting into an interrupt while sending a packet, no?

Kernel/Net/Intel/E1000Registers.h Outdated Show resolved Hide resolved
Copy link

stale bot commented Jan 5, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jan 5, 2025
Copy link

stale bot commented Jan 16, 2025

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!


// https://www.intel.com/content/dam/doc/manual/pci-pci-x-family-gbe-controllers-software-dev-manual.pdf
// Table 13-2
enum class Register {
Copy link
Contributor

@Kusekushi Kusekushi Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think it could be nice to have this list sorted by category. In later datasheets you have an even clearer separation between types of registers.
i.e. https://www.mouser.com/pdfdocs/82579datasheetvol21.pdf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently its in numeric order preferring the legacy aliases
In the future we may have to support the "array-like" register types, which are ordered a bit more nicely

For now I could add a few more line separations whenever we skip a register, which acheives something similar for now

in32(REG_INTERRUPT_CAUSE_READ);
// FIXME: Do this properly,
// There's probably a way to find an ideal interrupt rate etc
m_registers.write<Register::InterruptThrottling>(6000); // Interrupt rate of 1.536 milliseconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to calculate the ideal rate dynamically based on packet/byte counts during the last firing of the interrupt. We have to test what the ideal boundaries are - so it may be out of scope for this PR. Would be great though if there is some sort of function that runs after each interrupt though if we decide to go forward with this.

} else {
out32(REG_EEPROM, ((u32)address << 2) | 1);
while (!((tmp = in32(REG_EEPROM)) & (1 << 1)))
// FIXME: Should this just return 0 then?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO yes. We could give an error back instead of crashing(?) the system, but that's personal preference.

For this we:
- Introduce an operating mode
- Allow getting the MAC address from firmware initialized hw-registers
- Add support for advanced receive descriptors, as qemu
  does not support the legacy mode for these in `igb` mode
- Remove the `E1000ENetworkAdapter` driver

With this we can now boot on qemu with the `igb` network devices
selected.
@Hendiadyoin1 Hendiadyoin1 marked this pull request as ready for review February 2, 2025 15:20
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 pr-needs-review PR needs review from a maintainer or community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants