Skip to contentSkip to conversation

net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller

PATCH Superseded Mans Rullgard 2 participants 2 messages Nov 18, 2015 – Nov 19, 2015

Subsystems (2)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 net: ethernet: add driver for Aurora VLSI NB8800 Ethernet controller

This adds a driver for the Aurora VLSI NB8800 Ethernet controller. It is an almost complete rewrite of a driver originally found in a Sigma Designs 2.6.22 tree.

---
Changes:
- fix int / unsigned int mismatch
- spell out "unsigned int"

---
 drivers/net/ethernet/Kconfig         |    1 +
 drivers/net/ethernet/Makefile        |    1 +
 drivers/net/ethernet/aurora/Kconfig  |   20 +
 drivers/net/ethernet/aurora/Makefile |    1 +
 drivers/net/ethernet/aurora/nb8800.c | 1552 ++++++++++++++++++++++++++++++++++
 drivers/net/ethernet/aurora/nb8800.h |  316 +++++++
 6 files changed, 1891 insertions(+)
 create mode 100644 drivers/net/ethernet/aurora/Kconfig
 create mode 100644 drivers/net/ethernet/aurora/Makefile
 create mode 100644 drivers/net/ethernet/aurora/nb8800.c
 create mode 100644 drivers/net/ethernet/aurora/nb8800.h
drivers/net/ethernet/Kconfig +1 -0
index 05aa759..8310163 100644
@@ -29,6 +29,7 @@ source "drivers/net/ethernet/apm/Kconfig"
 source "drivers/net/ethernet/apple/Kconfig"
 source "drivers/net/ethernet/arc/Kconfig"
 source "drivers/net/ethernet/atheros/Kconfig"
+source "drivers/net/ethernet/aurora/Kconfig"
 source "drivers/net/ethernet/cadence/Kconfig"
 source "drivers/net/ethernet/adi/Kconfig"
 source "drivers/net/ethernet/broadcom/Kconfig"
drivers/net/ethernet/Makefile +1 -0
index ddfc808..b435fb0 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_NET_XGENE) += apm/
 obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
 obj-$(CONFIG_NET_VENDOR_ARC) += arc/
 obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
+obj-$(CONFIG_NET_VENDOR_AURORA) += aurora/
 obj-$(CONFIG_NET_CADENCE) += cadence/
 obj-$(CONFIG_NET_BFIN) += adi/
 obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/
drivers/net/ethernet/aurora/Kconfig new file +20 -0
new file mode 100644
index 0000000..a3c7106
@@ -0,0 +1,20 @@
+config NET_VENDOR_AURORA
+	bool "Aurora VLSI devices"
+	help
+	  If you have a network (Ethernet) device belonging to this class,
+	  say Y.
+
+	  Note that the answer to this question doesn't directly affect the
+	  kernel: saying N will just cause the configurator to skip all
+	  questions about Aurora devices. If you say Y, you will be asked
+	  for your specific device in the following questions.
+
+if NET_VENDOR_AURORA
+
+config AURORA_NB8800
+	tristate "Aurora AU-NB8800 support"
+	select PHYLIB
+	help
+	 Support for the AU-NB8800 gigabit Ethernet controller.
+
+endif
drivers/net/ethernet/aurora/Makefile new file +1 -0
new file mode 100644
index 0000000..6cb528a
@@ -0,0 +1 @@
+obj-$(CONFIG_AURORA_NB8800) += nb8800.o
drivers/net/ethernet/aurora/nb8800.c new file +1552 -0

1,552 lines not on this page · raw message

drivers/net/ethernet/aurora/nb8800.h new file +316 -0

316 lines not on this page · raw message

Signature · 1 line
2.6.3
maintainer
#1 lore raw

From: Mans Rullgard <[email protected]>
Date: Wed, 18 Nov 2015 17:29:24 +0000

Quoted 8 lines
drivers/net/ethernet/aurora/nb8800.c new file +8 -0
+static int nb8800_poll(struct napi_struct *napi, int budget)
+{
+	struct net_device *dev = napi->dev;
+	struct nb8800_priv *priv = netdev_priv(dev);
+	struct nb8800_rx_desc *rxd;
+	int work = 0;
+	int last = priv->rx_eoc;
+	int next;

...

drivers/net/ethernet/aurora/nb8800.c line 309

Quoted 1 line
drivers/net/ethernet/aurora/nb8800.c new file +1 -0
+		next = (last + 1) % RX_DESC_COUNT;

You should look at what the assembler looks like for these modulo operations.

They will be much simpler (ie. one instruction) if you use unsigned variables to hold the queue indices.

Please fix this in the entire driver.