net: add PCINet driver
Subsystems (2)
RFC 1/1 net: add PCINet driver
This adds support to Linux for a virtual ethernet interface which uses the PCI bus as its transport mechanism. It creates a simple, familiar, and fast method of communication for two devices connected by a PCI interface.
I have implemented client support for the Freescale MPC8349EMDS board, which is capable of running in PCI Agent mode (It acts like a PCI card, but is a complete PowerPC computer, running Linux). It is almost certainly trivially ported to any MPC83xx system.
It was developed to work in a CompactPCI crate of computers, one of which is a relatively standard x86 system (acting as the host) and many PowerPC systems (acting as clients).
---
Hello netdev. This is my first network driver, so take it easy on me. :) I'm quite sure it isn't ready for inclusion into mainline yet, but I think it is in good enough shape for some review.
The major issues I see:
1) The name wqt originally stood for "workqueue-test" and somewhat evolved into this driver. I'm looking for suggestions. I'd like to have something that is the same between the host and client drivers, since most of the code is identical. It makes copy/paste easier. The only one I can come up with is "bpc" for "Backplane Communications".
2) In the Freescale client driver, I use the whole set of IMMR (board control) registers. I only need a very small subset of them only during startup. I used them the way I did so I could use the same pcinet_hw.h file for both the client and server drivers.
3) I just ioremap()ed the IMMR registers directly. (They're at 0xe0000000). I just didn't know a better way to do this. I need them to set up the PCI memory containing the buffer descriptors.
4) I just hardcoded the address of the outbound PCI window into the DMA transfer code. It is at 0x80000000. Suggestions are welcome.
Why I made some decisions:
1) The PCINET_NET_REGISTERS_VALID bit: I want to be able to use this driver from U-Boot to copy a kernel, etc. over the PCI backplane to boot up the board. This meant that the memory that I used for the buffer descriptors disappears while the machine is booting Linux. Suggestions are welcome.
2) The buffer descriptors in client memory, rather than host memory: I thought it seemed more logical. Also, in my application, the clients will be transferring much more data to the host.
3) Use of the Freescale (client) DMA controller to transfer all data: I tried transferring all of the data using the CPU on each board. This turned out to be extremely slow, as in 2-3 MB/sec max. Using the DMA controller, I get ~40 MB/sec (tested with netperf).
4) Use of a static 1GB window to access the host's memory (to copy skbs):
Maintaining the window while DMA's are in flight, and then changing them seemed to be too much trouble. A static window just seemed easier. Also, removing the overhead of moving the window from each skb transferred actually gave a reasonable speedup.
5) The uart stuff: I needed a method to talk to the U-Boot bootloader on these boards without plugging in a serial cable. When my project gets going, I'll have 150 of them. Booting them one at a time is out of the question. A virtual serial port was simple to implement using the same hardware that I used for the network driver.
I'll post the U-Boot driver to their mailing list once this driver is finalized.
Thanks,
Ira
drivers/net/Kconfig | 34 ++ drivers/net/Makefile | 3 + drivers/net/pcinet.h | 77 +++ drivers/net/pcinet_fsl.c | 1360 +++++++++++++++++++++++++++++++++++++++++++ drivers/net/pcinet_host.c | 1392 +++++++++++++++++++++++++++++++++++++++++++++ drivers/net/pcinet_hw.h | 80 +++ 6 files changed, 2946 insertions(+), 0 deletions(-) create mode 100644 drivers/net/pcinet.h create mode 100644 drivers/net/pcinet_fsl.c create mode 100644 drivers/net/pcinet_host.c create mode 100644 drivers/net/pcinet_hw.h
drivers/net/Kconfig +34 -0
@@ -2259,6 +2259,40 @@ config UGETH_TX_ON_DEMAND bool "Transmit on Demand support" depends on UCC_GETH +config PCINET_FSL + tristate "PCINet Virtual Ethernet over PCI support (Freescale)" + depends on MPC834x_MDS && !PCI + select DMA_ENGINE + select FSL_DMA + help + When running as a PCI Agent, this driver will create a virtual + ethernet link running over the PCI bus, allowing simplified + communication with the host system. The host system will need + to use the corresponding driver. + + If in doubt, say N. + +config PCINET_HOST + tristate "PCINet Virtual Ethernet over PCI support (Host)" + depends on PCI + help + This driver will let you communicate with a PCINet client device + using a virtual ethernet link running over the PCI bus. This + allows simplified communication with the client system. + + This is inteded for use in a system that has a crate full of + computers running Linux, all connected by a PCI backplane. + + If in doubt, say N. + +config PCINET_DISABLE_CHECKSUM + bool "Disable packet checksumming" + depends on PCINET_FSL || PCINET_HOST + default n + help + Disable packet checksumming on packets received by the PCINet + driver. This gives a possible speed boost. + config MV643XX_ETH tristate "Marvell Discovery (643XX) and Orion ethernet support" depends on MV64360 || MV64X60 || (PPC_MULTIPLATFORM && PPC32) || PLAT_ORION
drivers/net/Makefile +3 -0
@@ -27,6 +27,9 @@ gianfar_driver-objs := gianfar.o \ obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o ucc_geth_ethtool.o +obj-$(CONFIG_PCINET_FSL) += pcinet_fsl.o +obj-$(CONFIG_PCINET_HOST) += pcinet_host.o + # # link order important here #
drivers/net/pcinet.h new file +77 -0
77 lines not on this page · raw message
drivers/net/pcinet_fsl.c new file +1360 -0
1,360 lines not on this page · raw message
drivers/net/pcinet_host.c new file +1392 -0
1,392 lines not on this page · raw message
drivers/net/pcinet_hw.h new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
1.5.4.3