MCPcopy Create free account
hub / github.com/Bananymous/banan-os / add_interface

Method add_interface

kernel/kernel/Networking/NetworkManager.cpp:35–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 BAN::ErrorOr<void> NetworkManager::add_interface(PCI::Device& pci_device)
36 {
37 BAN::RefPtr<NetworkInterface> interface;
38
39 switch (pci_device.subclass())
40 {
41 case 0x00:
42 if (E1000::probe(pci_device))
43 {
44 interface = TRY(E1000::create(pci_device));
45 break;
46 }
47 if (E1000E::probe(pci_device))
48 {
49 interface = TRY(E1000E::create(pci_device));
50 break;
51 }
52 if (RTL8169::probe(pci_device))
53 {
54 interface = TRY(RTL8169::create(pci_device));
55 break;
56 }
57 // fall through
58 default:
59 dprintln("unsupported network controller (pci {2H}.{2H}.{2H})", pci_device.class_code(), pci_device.subclass(), pci_device.prog_if());
60 dprintln(" vendor id: {4H}", pci_device.vendor_id());
61 dprintln(" device id: {4H}", pci_device.device_id());
62 return BAN::Error::from_errno(ENOTSUP);
63 }
64
65 ASSERT(interface);
66
67 return add_interface(interface);
68 }
69
70 BAN::ErrorOr<void> NetworkManager::add_interface(BAN::RefPtr<NetworkInterface> interface)
71 {

Callers 2

initialize_devicesMethod · 0.80
initializeMethod · 0.80

Calls 7

subclassMethod · 0.80
class_codeMethod · 0.80
prog_ifMethod · 0.80
vendor_idMethod · 0.80
device_idMethod · 0.80
add_deviceMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected