: Second preliminary release of Sun Neptune driver
Subsystems (2)
David Miller
maintainerPATCH 1/1 : Second preliminary release of Sun Neptune driver
Ok, this is rev2, changes:
1) Jumbo MTU support is now present. I got stuck on this for a while because I didn't realize that resetting the RX XMAC would reset the XMAC_MAX register. I thought that was a TX XMAC resource, ho hum...
Fix this by re-initializing the TX MAC after resetting the RX MAC.
2) Implementing support for jumbograms required a re-examination of how TX queue handling was done.
Neptune can report the TX Head at a location which is in the middle of a packet's group of descriptors for a multi segment packet. Working around this would just overly complicate the code.
We don't need to use the TX Head register. Instead, track the "pkt_cnt" field of the TX_CS register. The difference since the last reading is the number of full TX frames we can reclaim from the ring.
This is not only simpler, it allows us to only need one MMIO access (for TX_CS) during a reclaim run instead of two (TX_CS and TX_RING_HDL).
A side note, I'm purposefully not using TX mailbox support. It's broken in Neptune. If you get the registers in the DMA mailbox, MK and MMK are always both set in the TX_CS register. So even if you write the MK and MB bits back to TX_CS to clear the interrupt, the MMK propagates to MK and you thus get another interrupt. This basically makes TX DMA mailbox support useless.
4) All register write accessors are now of the form xxx(reg, val) instead of xxx(val, reg)
5) Kill PCI_DEVICE_ID_SUN_NEPTUNE define, unneeded.
Performance isn't the best, but the driver is reasonably solid. After I flesh out the remaining features that need to be implemented I'll take a closer look at that.
Enjoy.
commit 684a7c25fff607dc647f065761bb381f28bddbdb
Author: David S. Miller <[email protected]> Date: Thu Sep 27 21:43:57 2007 -0700
[NIU]: Add Sun Neptune ethernet driver.
drivers/net/Kconfig +7 -0
@@ -2601,6 +2601,13 @@ config NETXEN_NIC help This enables the support for NetXen's Gigabit Ethernet card. +config NIU + tristate "Sun Neptune 10Gbit Ethernet support" + depends on PCI + help + This enables support for cards based upon Sun's + Neptune chipset. + config PASEMI_MAC tristate "PA Semi 1/10Gbit MAC" depends on PPC64 && PCI
drivers/net/Makefile +1 -0
@@ -242,3 +242,4 @@ obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_FS_ENET) += fs_enet/ obj-$(CONFIG_NETXEN_NIC) += netxen/ +obj-$(CONFIG_NIU) += niu.o
drivers/net/niu.c new file +7572 -0
2,983 lines not on this page · raw message
drivers/net/niu.h new file +3217 -0
3,217 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
drivers/net/niu.c
Quoted 85 lines · David Miller
Ok, this is rev2, changes:
1) Jumbo MTU support is now present. I got stuck on this for a while because I didn't realize that resetting the RX XMAC would reset the
XMAC_MAXregister. I thought that was a TX XMAC resource, ho hum...Fix this by re-initializing the TX MAC after resetting the RX MAC.
2) Implementing support for jumbograms required a re-examination of how TX queue handling was done.
Neptune can report the TX Head at a location which is in the middle of a packet's group of descriptors for a multi segment packet. Working around this would just overly complicate the code.
We don't need to use the TX Head register. Instead, track the "
pkt_cnt" field of theTX_CSregister. The difference since the last reading is the number of full TX frames we can reclaim from the ring.This is not only simpler, it allows us to only need one MMIO access (for
TX_CS) during a reclaim run instead of two (TX_CSandTX_RING_HDL).A side note, I'm purposefully not using TX mailbox support. It's broken in Neptune. If you get the registers in the DMA mailbox, MK and MMK are always both set in the
TX_CSregister. So even if you write the MK and MB bits back toTX_CSto clear the interrupt, the MMK propagates to MK and you thus get another interrupt. This basically makes TX DMA mailbox support useless.4) All register write accessors are now of the form
xxx(reg, val)instead ofxxx(val, reg)5) Kill
PCI_DEVICE_ID_SUN_NEPTUNEdefine, unneeded.Performance isn't the best, but the driver is reasonably solid. After I flesh out the remaining features that need to be implemented I'll take a closer look at that.
Enjoy.
commit
684a7c25fff607dc647f065761bb381f28bddbdbAuthor: David S. Miller <[email protected]> Date: Thu Sep 27 21:43:57 2007 -0700[NIU]: Add Sun Neptune ethernet driver.
Signed-off-by David S. Miller <[email protected]>drivers/net/Kconfig +7
-0@@ -2601,6 +2601,13 @@ config NETXEN_NIC help This enables the support for NetXen's Gigabit Ethernet card. +config NIU + tristate "Sun Neptune 10Gbit Ethernet support" + depends on PCI + help + This enables support for cards based upon Sun's + Neptune chipset. + config PASEMI_MAC tristate "PA Semi 1/10Gbit MAC" depends on PPC64 && PCIdrivers/net/Makefile +1
-0@@ -242,3 +242,4 @@ obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_FS_ENET) += fs_enet/ obj-$(CONFIG_NETXEN_NIC) += netxen/ +obj-$(CONFIG_NIU) += niu.odrivers/net/niu.c new file +0
-0
Dave,
Couple of comments on Jumbo support
TX Side:
Can we rule of fragment size > MAX_TX_DESC_LEN? If that is not the case, then the frags my need the same tx post and reclaim logic as the skb->data
RX Side
Since the MAC is set not to strip FCS bytes, the last page could
contain just 1 - 4 bytes of FCS. Not only this wastes the page but may result on bug RX process where skb->len is wrong and a page with junk is passed to the stack. In our off-the-tree driver, we check this condition and repost the last page back to the rbr, if it contains just the FCS bytes.
Regards,
Matheos