This experimental series separates drivers for PCI / PCIE NIC's and adds initial phylib support to the separated r8168 driver.
There are significant differences between the older PCI-based chips (MAC version <= 6) and the newer PCIE-based chips, e.g. the older chips partially support a not MII-compatible TBI fibre mode. Adding phylib support is much easier focusing on the newer chips only. I think separating the drivers is justified and would be interested to hear the opinion of others. The series works fine on my Zotac Mini-PC with a RTL8168evl (MAC version 34), see also system log (grepped for r8168). r8168 Gigabit Ethernet driver 2.3LK-NAPI loaded r8168 0000:03:00.0: enabling device (0000 -> 0003) libphy: r8168: probed RTL8211E Gigabit Ethernet r8168-03:00.0:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=r8168-03:00.0:00, irq=IGNORE) r8168 0000:03:00.0 eth0: RTL8168evl/8111evl at 0x0000000069abeaff, 00:01:2e:65:37:46, XID 0c900800 IRQ 50 r8168 0000:03:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko] r8168 Gigabit Ethernet driver 2.3LK-NAPI loaded r8168 0000:04:00.0: enabling device (0000 -> 0003) libphy: r8168: probed RTL8211E Gigabit Ethernet r8168-04:00.0:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=r8168-04:00.0:00, irq=IGNORE) r8168 0000:04:00.0 eth1: RTL8168evl/8111evl at 0x00000000841e72a7, 00:01:2e:65:37:47, XID 0c900800 IRQ 51 r8168 0000:04:00.0 eth1: jumbo features [frames: 9200 bytes, tx checksumming: ko] r8168 0000:04:00.0 enp4s0: renamed from eth1 r8168 0000:03:00.0 enp3s0: renamed from eth0 r8168 0000:04:00.0 enp4s0: Link is Down r8168 0000:04:00.0 enp4s0: Link is Up - 1Gbps/Full - flow control rx/tx What's still missing: - Remove all support for chips with MAC version > 06 from r8169 driver. This would drastically reduce its size. - The driver loads firmware for the PHY, therefore we may need firmware loading support also for the Realtek driver under drivers/net/phy. Best should be to factor out firmware loading support into a separate driver under drivers/firmware. I have a working experimental version, but it's still WIP. - Support all NIC-internal PHY's by the Realtek driver under drivers/net/phy and move all PHY init code there. To do this we'd need a list with the PHY id per chip / MAC version. Just by chance the PHY in RTL8168evl identifies as RTL8211E and has certain support already (w/o firmware). Heiner Kallweit (18): r8169: split driver to one for the non-PCIE cards (r8169) and one for the PCIE cards (r8168) r8168: remove code specific to MAC version 01 - 06 r8168: remove magic register handling used on MAC version 05 and 06 only r8168: remove TBI mode support needed for MAC version 01 only r8168: remove unneeded callbacks from struct rtl8169_private r8168: remove function rtl8169_rx_missed() being specific to MAC version 01 - 06 r8168: replace 8169 with 8168 in all relevant symbols r8168: add basic phylib support r8168: use genphy_soft_reset instead of open coding the soft reset r8168: switch to phy_ethtool_get/set_link_ksettings r8168: switch to phy_ethtool_nway_reset r8168: switch to phy_mii_ioctl r8168: replace speed_down with genphy_restart_aneg r8168: remove rtl8168_set_speed r8168: remove rtl_phy_work and rtl8168_phy_timer r8168: use phy_read/write in rtl_readphy/writephy helpers r8168: remove use of struct mii_if_info r8168: use link speed information as maintained by phylib drivers/net/ethernet/realtek/Kconfig | 20 +- drivers/net/ethernet/realtek/Makefile | 1 + drivers/net/ethernet/realtek/r8168.c | 8053 +++++++++++++++++++++++++++++++++ drivers/net/ethernet/realtek/r8169.c | 112 +- 4 files changed, 8077 insertions(+), 109 deletions(-) create mode 100644 drivers/net/ethernet/realtek/r8168.c -- 2.15.1