net: spider_net: Remove powerpc Cell driver

This driver can no longer be built since support for IBM Cell Blades was
removed, in particular PPC_IBM_CELL_BLADE.

Remove the driver and the documentation.
Remove the MAINTAINERS entry, and add Ishizaki and Geoff to CREDITS.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241218105523.416573-24-mpe@ellerman.id.au
This commit is contained in:
Michael Ellerman 2024-12-18 21:55:12 +11:00 committed by Madhavan Srinivasan
parent 16479389cf
commit d9fefcea81
9 changed files with 8 additions and 3428 deletions

View File

@ -2187,6 +2187,10 @@ D: Various ACPI fixes, keeping correct battery state through suspend
D: various lockdep annotations, autofs and other random bugfixes
S: Prague, Czech Republic
N: Ishizaki Kou
E: kou.ishizaki@toshiba.co.jp
D: Spidernet driver for PowerPC Cell platforms
N: Gene Kozin
E: 74604.152@compuserve.com
W: https://www.sangoma.com
@ -2392,6 +2396,10 @@ S: ICP vortex GmbH
S: Neckarsulm
S: Germany
N: Geoff Levand
E: geoff@infradead.org
D: Spidernet driver for PowerPC Cell platforms
N: Phil Lewis
E: beans@bucket.ualr.edu
D: Promised to send money if I would put his name in the source tree.

View File

@ -55,7 +55,6 @@ Contents:
ti/cpsw_switchdev
ti/am65_nuss_cpsw_switchdev
ti/tlan
toshiba/spider_net
wangxun/txgbe
wangxun/ngbe

View File

@ -1,202 +0,0 @@
.. SPDX-License-Identifier: GPL-2.0
===========================
The Spidernet Device Driver
===========================
Written by Linas Vepstas <linas@austin.ibm.com>
Version of 7 June 2007
Abstract
========
This document sketches the structure of portions of the spidernet
device driver in the Linux kernel tree. The spidernet is a gigabit
ethernet device built into the Toshiba southbridge commonly used
in the SONY Playstation 3 and the IBM QS20 Cell blade.
The Structure of the RX Ring.
=============================
The receive (RX) ring is a circular linked list of RX descriptors,
together with three pointers into the ring that are used to manage its
contents.
The elements of the ring are called "descriptors" or "descrs"; they
describe the received data. This includes a pointer to a buffer
containing the received data, the buffer size, and various status bits.
There are three primary states that a descriptor can be in: "empty",
"full" and "not-in-use". An "empty" or "ready" descriptor is ready
to receive data from the hardware. A "full" descriptor has data in it,
and is waiting to be emptied and processed by the OS. A "not-in-use"
descriptor is neither empty or full; it is simply not ready. It may
not even have a data buffer in it, or is otherwise unusable.
During normal operation, on device startup, the OS (specifically, the
spidernet device driver) allocates a set of RX descriptors and RX
buffers. These are all marked "empty", ready to receive data. This
ring is handed off to the hardware, which sequentially fills in the
buffers, and marks them "full". The OS follows up, taking the full
buffers, processing them, and re-marking them empty.
This filling and emptying is managed by three pointers, the "head"
and "tail" pointers, managed by the OS, and a hardware current
descriptor pointer (GDACTDPA). The GDACTDPA points at the descr
currently being filled. When this descr is filled, the hardware
marks it full, and advances the GDACTDPA by one. Thus, when there is
flowing RX traffic, every descr behind it should be marked "full",
and everything in front of it should be "empty". If the hardware
discovers that the current descr is not empty, it will signal an
interrupt, and halt processing.
The tail pointer tails or trails the hardware pointer. When the
hardware is ahead, the tail pointer will be pointing at a "full"
descr. The OS will process this descr, and then mark it "not-in-use",
and advance the tail pointer. Thus, when there is flowing RX traffic,
all of the descrs in front of the tail pointer should be "full", and
all of those behind it should be "not-in-use". When RX traffic is not
flowing, then the tail pointer can catch up to the hardware pointer.
The OS will then note that the current tail is "empty", and halt
processing.
The head pointer (somewhat mis-named) follows after the tail pointer.
When traffic is flowing, then the head pointer will be pointing at
a "not-in-use" descr. The OS will perform various housekeeping duties
on this descr. This includes allocating a new data buffer and
dma-mapping it so as to make it visible to the hardware. The OS will
then mark the descr as "empty", ready to receive data. Thus, when there
is flowing RX traffic, everything in front of the head pointer should
be "not-in-use", and everything behind it should be "empty". If no
RX traffic is flowing, then the head pointer can catch up to the tail
pointer, at which point the OS will notice that the head descr is
"empty", and it will halt processing.
Thus, in an idle system, the GDACTDPA, tail and head pointers will
all be pointing at the same descr, which should be "empty". All of the
other descrs in the ring should be "empty" as well.
The show_rx_chain() routine will print out the locations of the
GDACTDPA, tail and head pointers. It will also summarize the contents
of the ring, starting at the tail pointer, and listing the status
of the descrs that follow.
A typical example of the output, for a nearly idle system, might be::
net eth1: Total number of descrs=256
net eth1: Chain tail located at descr=20
net eth1: Chain head is at 20
net eth1: HW curr desc (GDACTDPA) is at 21
net eth1: Have 1 descrs with stat=x40800101
net eth1: HW next desc (GDACNEXTDA) is at 22
net eth1: Last 255 descrs with stat=xa0800000
In the above, the hardware has filled in one descr, number 20. Both
head and tail are pointing at 20, because it has not yet been emptied.
Meanwhile, hw is pointing at 21, which is free.
The "Have nnn decrs" refers to the descr starting at the tail: in this
case, nnn=1 descr, starting at descr 20. The "Last nnn descrs" refers
to all of the rest of the descrs, from the last status change. The "nnn"
is a count of how many descrs have exactly the same status.
The status x4... corresponds to "full" and status xa... corresponds
to "empty". The actual value printed is RXCOMST_A.
In the device driver source code, a different set of names are
used for these same concepts, so that::
"empty" == SPIDER_NET_DESCR_CARDOWNED == 0xa
"full" == SPIDER_NET_DESCR_FRAME_END == 0x4
"not in use" == SPIDER_NET_DESCR_NOT_IN_USE == 0xf
The RX RAM full bug/feature
===========================
As long as the OS can empty out the RX buffers at a rate faster than
the hardware can fill them, there is no problem. If, for some reason,
the OS fails to empty the RX ring fast enough, the hardware GDACTDPA
pointer will catch up to the head, notice the not-empty condition,
ad stop. However, RX packets may still continue arriving on the wire.
The spidernet chip can save some limited number of these in local RAM.
When this local ram fills up, the spider chip will issue an interrupt
indicating this (GHIINT0STS will show ERRINT, and the GRMFLLINT bit
will be set in GHIINT1STS). When the RX ram full condition occurs,
a certain bug/feature is triggered that has to be specially handled.
This section describes the special handling for this condition.
When the OS finally has a chance to run, it will empty out the RX ring.
In particular, it will clear the descriptor on which the hardware had
stopped. However, once the hardware has decided that a certain
descriptor is invalid, it will not restart at that descriptor; instead
it will restart at the next descr. This potentially will lead to a
deadlock condition, as the tail pointer will be pointing at this descr,
which, from the OS point of view, is empty; the OS will be waiting for
this descr to be filled. However, the hardware has skipped this descr,
and is filling the next descrs. Since the OS doesn't see this, there
is a potential deadlock, with the OS waiting for one descr to fill,
while the hardware is waiting for a different set of descrs to become
empty.
A call to show_rx_chain() at this point indicates the nature of the
problem. A typical print when the network is hung shows the following::
net eth1: Spider RX RAM full, incoming packets might be discarded!
net eth1: Total number of descrs=256
net eth1: Chain tail located at descr=255
net eth1: Chain head is at 255
net eth1: HW curr desc (GDACTDPA) is at 0
net eth1: Have 1 descrs with stat=xa0800000
net eth1: HW next desc (GDACNEXTDA) is at 1
net eth1: Have 127 descrs with stat=x40800101
net eth1: Have 1 descrs with stat=x40800001
net eth1: Have 126 descrs with stat=x40800101
net eth1: Last 1 descrs with stat=xa0800000
Both the tail and head pointers are pointing at descr 255, which is
marked xa... which is "empty". Thus, from the OS point of view, there
is nothing to be done. In particular, there is the implicit assumption
that everything in front of the "empty" descr must surely also be empty,
as explained in the last section. The OS is waiting for descr 255 to
become non-empty, which, in this case, will never happen.
The HW pointer is at descr 0. This descr is marked 0x4.. or "full".
Since its already full, the hardware can do nothing more, and thus has
halted processing. Notice that descrs 0 through 254 are all marked
"full", while descr 254 and 255 are empty. (The "Last 1 descrs" is
descr 254, since tail was at 255.) Thus, the system is deadlocked,
and there can be no forward progress; the OS thinks there's nothing
to do, and the hardware has nowhere to put incoming data.
This bug/feature is worked around with the spider_net_resync_head_ptr()
routine. When the driver receives RX interrupts, but an examination
of the RX chain seems to show it is empty, then it is probable that
the hardware has skipped a descr or two (sometimes dozens under heavy
network conditions). The spider_net_resync_head_ptr() subroutine will
search the ring for the next full descr, and the driver will resume
operations there. Since this will leave "holes" in the ring, there
is also a spider_net_resync_tail_ptr() that will skip over such holes.
As of this writing, the spider_net_resync() strategy seems to work very
well, even under heavy network loads.
The TX ring
===========
The TX ring uses a low-watermark interrupt scheme to make sure that
the TX queue is appropriately serviced for large packet sizes.
For packet sizes greater than about 1KBytes, the kernel can fill
the TX ring quicker than the device can drain it. Once the ring
is full, the netdev is stopped. When there is room in the ring,
the netdev needs to be reawakened, so that more TX packets are placed
in the ring. The hardware can empty the ring about four times per jiffy,
so its not appropriate to wait for the poll routine to refill, since
the poll routine runs only once per jiffy. The low-watermark mechanism
marks a descr about 1/4th of the way from the bottom of the queue, so
that an interrupt is generated when the descr is processed. This
interrupt wakes up the netdev, which can then refill the queue.
For large packets, this mechanism generates a relatively small number
of interrupts, about 1K/sec. For smaller packets, this will drop to zero
interrupts, as the hardware can empty the queue faster than the kernel
can fill it.

View File

@ -22351,15 +22351,6 @@ F: include/linux/spi/
F: include/uapi/linux/spi/
F: tools/spi/
SPIDERNET NETWORK DRIVER for CELL
M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp>
M: Geoff Levand <geoff@infradead.org>
L: netdev@vger.kernel.org
L: linuxppc-dev@lists.ozlabs.org
S: Maintained
F: Documentation/networking/device_drivers/ethernet/toshiba/spider_net.rst
F: drivers/net/ethernet/toshiba/spider_net*
SPMI SUBSYSTEM
M: Stephen Boyd <sboyd@kernel.org>
L: linux-kernel@vger.kernel.org

View File

@ -39,15 +39,6 @@ config GELIC_WIRELESS
the driver automatically distinguishes the models, you can
safely enable this option even if you have a wireless-less model.
config SPIDER_NET
tristate "Spider Gigabit Ethernet driver"
depends on PCI && PPC_IBM_CELL_BLADE
select FW_LOADER
select SUNGEM_PHY
help
This driver supports the Gigabit Ethernet chips present on the
Cell Processor-Based Blades from IBM.
config TC35815
tristate "TOSHIBA TC35815 Ethernet support"
depends on PCI && MIPS

View File

@ -6,6 +6,4 @@
obj-$(CONFIG_GELIC_NET) += ps3_gelic.o
gelic_wireless-$(CONFIG_GELIC_WIRELESS) += ps3_gelic_wireless.o
ps3_gelic-objs += ps3_gelic_net.o $(gelic_wireless-y)
spidernet-y += spider_net.o spider_net_ethtool.o
obj-$(CONFIG_SPIDER_NET) += spidernet.o
obj-$(CONFIG_TC35815) += tc35815.o

File diff suppressed because it is too large Load Diff

View File

@ -1,475 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Network device driver for Cell Processor-Based Blade and Celleb platform
*
* (C) Copyright IBM Corp. 2005
* (C) Copyright 2006 TOSHIBA CORPORATION
*
* Authors : Utz Bacher <utz.bacher@de.ibm.com>
* Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
*/
#ifndef _SPIDER_NET_H
#define _SPIDER_NET_H
#define VERSION "2.0 B"
#include <linux/sungem_phy.h>
int spider_net_stop(struct net_device *netdev);
int spider_net_open(struct net_device *netdev);
extern const struct ethtool_ops spider_net_ethtool_ops;
extern char spider_net_driver_name[];
#define SPIDER_NET_MAX_FRAME 2312
#define SPIDER_NET_MAX_MTU 2294
#define SPIDER_NET_MIN_MTU 64
#define SPIDER_NET_RXBUF_ALIGN 128
#define SPIDER_NET_RX_DESCRIPTORS_DEFAULT 256
#define SPIDER_NET_RX_DESCRIPTORS_MIN 16
#define SPIDER_NET_RX_DESCRIPTORS_MAX 512
#define SPIDER_NET_TX_DESCRIPTORS_DEFAULT 256
#define SPIDER_NET_TX_DESCRIPTORS_MIN 16
#define SPIDER_NET_TX_DESCRIPTORS_MAX 512
#define SPIDER_NET_TX_TIMER (HZ/5)
#define SPIDER_NET_ANEG_TIMER (HZ)
#define SPIDER_NET_ANEG_TIMEOUT 5
#define SPIDER_NET_RX_CSUM_DEFAULT 1
#define SPIDER_NET_WATCHDOG_TIMEOUT 50*HZ
#define SPIDER_NET_FIRMWARE_SEQS 6
#define SPIDER_NET_FIRMWARE_SEQWORDS 1024
#define SPIDER_NET_FIRMWARE_LEN (SPIDER_NET_FIRMWARE_SEQS * \
SPIDER_NET_FIRMWARE_SEQWORDS * \
sizeof(u32))
#define SPIDER_NET_FIRMWARE_NAME "spider_fw.bin"
/** spider_net SMMIO registers */
#define SPIDER_NET_GHIINT0STS 0x00000000
#define SPIDER_NET_GHIINT1STS 0x00000004
#define SPIDER_NET_GHIINT2STS 0x00000008
#define SPIDER_NET_GHIINT0MSK 0x00000010
#define SPIDER_NET_GHIINT1MSK 0x00000014
#define SPIDER_NET_GHIINT2MSK 0x00000018
#define SPIDER_NET_GRESUMINTNUM 0x00000020
#define SPIDER_NET_GREINTNUM 0x00000024
#define SPIDER_NET_GFFRMNUM 0x00000028
#define SPIDER_NET_GFAFRMNUM 0x0000002c
#define SPIDER_NET_GFBFRMNUM 0x00000030
#define SPIDER_NET_GFCFRMNUM 0x00000034
#define SPIDER_NET_GFDFRMNUM 0x00000038
/* clear them (don't use it) */
#define SPIDER_NET_GFREECNNUM 0x0000003c
#define SPIDER_NET_GONETIMENUM 0x00000040
#define SPIDER_NET_GTOUTFRMNUM 0x00000044
#define SPIDER_NET_GTXMDSET 0x00000050
#define SPIDER_NET_GPCCTRL 0x00000054
#define SPIDER_NET_GRXMDSET 0x00000058
#define SPIDER_NET_GIPSECINIT 0x0000005c
#define SPIDER_NET_GFTRESTRT 0x00000060
#define SPIDER_NET_GRXDMAEN 0x00000064
#define SPIDER_NET_GMRWOLCTRL 0x00000068
#define SPIDER_NET_GPCWOPCMD 0x0000006c
#define SPIDER_NET_GPCROPCMD 0x00000070
#define SPIDER_NET_GTTFRMCNT 0x00000078
#define SPIDER_NET_GTESTMD 0x0000007c
#define SPIDER_NET_GSINIT 0x00000080
#define SPIDER_NET_GSnPRGADR 0x00000084
#define SPIDER_NET_GSnPRGDAT 0x00000088
#define SPIDER_NET_GMACOPEMD 0x00000100
#define SPIDER_NET_GMACLENLMT 0x00000108
#define SPIDER_NET_GMACST 0x00000110
#define SPIDER_NET_GMACINTEN 0x00000118
#define SPIDER_NET_GMACPHYCTRL 0x00000120
#define SPIDER_NET_GMACAPAUSE 0x00000154
#define SPIDER_NET_GMACTXPAUSE 0x00000164
#define SPIDER_NET_GMACMODE 0x000001b0
#define SPIDER_NET_GMACBSTLMT 0x000001b4
#define SPIDER_NET_GMACUNIMACU 0x000001c0
#define SPIDER_NET_GMACUNIMACL 0x000001c8
#define SPIDER_NET_GMRMHFILnR 0x00000400
#define SPIDER_NET_MULTICAST_HASHES 256
#define SPIDER_NET_GMRUAFILnR 0x00000500
#define SPIDER_NET_GMRUA0FIL15R 0x00000578
#define SPIDER_NET_GTTQMSK 0x00000934
/* RX DMA controller registers, all 0x00000a.. are for DMA controller A,
* 0x00000b.. for DMA controller B, etc. */
#define SPIDER_NET_GDADCHA 0x00000a00
#define SPIDER_NET_GDADMACCNTR 0x00000a04
#define SPIDER_NET_GDACTDPA 0x00000a08
#define SPIDER_NET_GDACTDCNT 0x00000a0c
#define SPIDER_NET_GDACDBADDR 0x00000a20
#define SPIDER_NET_GDACDBSIZE 0x00000a24
#define SPIDER_NET_GDACNEXTDA 0x00000a28
#define SPIDER_NET_GDACCOMST 0x00000a2c
#define SPIDER_NET_GDAWBCOMST 0x00000a30
#define SPIDER_NET_GDAWBRSIZE 0x00000a34
#define SPIDER_NET_GDAWBVSIZE 0x00000a38
#define SPIDER_NET_GDAWBTRST 0x00000a3c
#define SPIDER_NET_GDAWBTRERR 0x00000a40
/* TX DMA controller registers */
#define SPIDER_NET_GDTDCHA 0x00000e00
#define SPIDER_NET_GDTDMACCNTR 0x00000e04
#define SPIDER_NET_GDTCDPA 0x00000e08
#define SPIDER_NET_GDTDMASEL 0x00000e14
#define SPIDER_NET_ECMODE 0x00000f00
/* clock and reset control register */
#define SPIDER_NET_CKRCTRL 0x00000ff0
/** SCONFIG registers */
#define SPIDER_NET_SCONFIG_IOACTE 0x00002810
/** interrupt mask registers */
#define SPIDER_NET_INT0_MASK_VALUE 0x3f7fe2c7
#define SPIDER_NET_INT1_MASK_VALUE 0x0000fff2
#define SPIDER_NET_INT2_MASK_VALUE 0x000003f1
/* we rely on flagged descriptor interrupts */
#define SPIDER_NET_FRAMENUM_VALUE 0x00000000
/* set this first, then the FRAMENUM_VALUE */
#define SPIDER_NET_GFXFRAMES_VALUE 0x00000000
#define SPIDER_NET_STOP_SEQ_VALUE 0x00000000
#define SPIDER_NET_RUN_SEQ_VALUE 0x0000007e
#define SPIDER_NET_PHY_CTRL_VALUE 0x00040040
/* #define SPIDER_NET_PHY_CTRL_VALUE 0x01070080*/
#define SPIDER_NET_RXMODE_VALUE 0x00000011
/* auto retransmission in case of MAC aborts */
#define SPIDER_NET_TXMODE_VALUE 0x00010000
#define SPIDER_NET_RESTART_VALUE 0x00000000
#define SPIDER_NET_WOL_VALUE 0x00001111
#if 0
#define SPIDER_NET_WOL_VALUE 0x00000000
#endif
#define SPIDER_NET_IPSECINIT_VALUE 0x6f716f71
/* pause frames: automatic, no upper retransmission count */
/* outside loopback mode: ETOMOD signal dont matter, not connected */
/* ETOMOD signal is brought to PHY reset. bit 2 must be 1 in Celleb */
#define SPIDER_NET_OPMODE_VALUE 0x00000067
/*#define SPIDER_NET_OPMODE_VALUE 0x001b0062*/
#define SPIDER_NET_LENLMT_VALUE 0x00000908
#define SPIDER_NET_MACAPAUSE_VALUE 0x00000800 /* about 1 ms */
#define SPIDER_NET_TXPAUSE_VALUE 0x00000000
#define SPIDER_NET_MACMODE_VALUE 0x00000001
#define SPIDER_NET_BURSTLMT_VALUE 0x00000200 /* about 16 us */
/* DMAC control register GDMACCNTR
*
* 1(0) enable r/tx dma
* 0000000 fixed to 0
*
* 000000 fixed to 0
* 0(1) en/disable descr writeback on force end
* 0(1) force end
*
* 000000 fixed to 0
* 00 burst alignment: 128 bytes
* 11 burst alignment: 1024 bytes
*
* 00000 fixed to 0
* 0 descr writeback size 32 bytes
* 0(1) descr chain end interrupt enable
* 0(1) descr status writeback enable */
/* to set RX_DMA_EN */
#define SPIDER_NET_DMA_RX_VALUE 0x80000000
#define SPIDER_NET_DMA_RX_FEND_VALUE 0x00030003
/* to set TX_DMA_EN */
#define SPIDER_NET_TX_DMA_EN 0x80000000
#define SPIDER_NET_GDTBSTA 0x00000300
#define SPIDER_NET_GDTDCEIDIS 0x00000002
#define SPIDER_NET_DMA_TX_VALUE SPIDER_NET_TX_DMA_EN | \
SPIDER_NET_GDTDCEIDIS | \
SPIDER_NET_GDTBSTA
#define SPIDER_NET_DMA_TX_FEND_VALUE 0x00030003
/* SPIDER_NET_UA_DESCR_VALUE is OR'ed with the unicast address */
#define SPIDER_NET_UA_DESCR_VALUE 0x00080000
#define SPIDER_NET_PROMISC_VALUE 0x00080000
#define SPIDER_NET_NONPROMISC_VALUE 0x00000000
#define SPIDER_NET_DMASEL_VALUE 0x00000001
#define SPIDER_NET_ECMODE_VALUE 0x00000000
#define SPIDER_NET_CKRCTRL_RUN_VALUE 0x1fff010f
#define SPIDER_NET_CKRCTRL_STOP_VALUE 0x0000010f
#define SPIDER_NET_SBIMSTATE_VALUE 0x00000000
#define SPIDER_NET_SBTMSTATE_VALUE 0x00000000
/* SPIDER_NET_GHIINT0STS bits, in reverse order so that they can be used
* with 1 << SPIDER_NET_... */
enum spider_net_int0_status {
SPIDER_NET_GPHYINT = 0,
SPIDER_NET_GMAC2INT,
SPIDER_NET_GMAC1INT,
SPIDER_NET_GIPSINT,
SPIDER_NET_GFIFOINT,
SPIDER_NET_GDMACINT,
SPIDER_NET_GSYSINT,
SPIDER_NET_GPWOPCMPINT,
SPIDER_NET_GPROPCMPINT,
SPIDER_NET_GPWFFINT,
SPIDER_NET_GRMDADRINT,
SPIDER_NET_GRMARPINT,
SPIDER_NET_GRMMPINT,
SPIDER_NET_GDTDEN0INT,
SPIDER_NET_GDDDEN0INT,
SPIDER_NET_GDCDEN0INT,
SPIDER_NET_GDBDEN0INT,
SPIDER_NET_GDADEN0INT,
SPIDER_NET_GDTFDCINT,
SPIDER_NET_GDDFDCINT,
SPIDER_NET_GDCFDCINT,
SPIDER_NET_GDBFDCINT,
SPIDER_NET_GDAFDCINT,
SPIDER_NET_GTTEDINT,
SPIDER_NET_GDTDCEINT,
SPIDER_NET_GRFDNMINT,
SPIDER_NET_GRFCNMINT,
SPIDER_NET_GRFBNMINT,
SPIDER_NET_GRFANMINT,
SPIDER_NET_GRFNMINT,
SPIDER_NET_G1TMCNTINT,
SPIDER_NET_GFREECNTINT
};
/* GHIINT1STS bits */
enum spider_net_int1_status {
SPIDER_NET_GTMFLLINT = 0,
SPIDER_NET_GRMFLLINT,
SPIDER_NET_GTMSHTINT,
SPIDER_NET_GDTINVDINT,
SPIDER_NET_GRFDFLLINT,
SPIDER_NET_GDDDCEINT,
SPIDER_NET_GDDINVDINT,
SPIDER_NET_GRFCFLLINT,
SPIDER_NET_GDCDCEINT,
SPIDER_NET_GDCINVDINT,
SPIDER_NET_GRFBFLLINT,
SPIDER_NET_GDBDCEINT,
SPIDER_NET_GDBINVDINT,
SPIDER_NET_GRFAFLLINT,
SPIDER_NET_GDADCEINT,
SPIDER_NET_GDAINVDINT,
SPIDER_NET_GDTRSERINT,
SPIDER_NET_GDDRSERINT,
SPIDER_NET_GDCRSERINT,
SPIDER_NET_GDBRSERINT,
SPIDER_NET_GDARSERINT,
SPIDER_NET_GDSERINT,
SPIDER_NET_GDTPTERINT,
SPIDER_NET_GDDPTERINT,
SPIDER_NET_GDCPTERINT,
SPIDER_NET_GDBPTERINT,
SPIDER_NET_GDAPTERINT
};
/* GHIINT2STS bits */
enum spider_net_int2_status {
SPIDER_NET_GPROPERINT = 0,
SPIDER_NET_GMCTCRSNGINT,
SPIDER_NET_GMCTLCOLINT,
SPIDER_NET_GMCTTMOTINT,
SPIDER_NET_GMCRCAERINT,
SPIDER_NET_GMCRCALERINT,
SPIDER_NET_GMCRALNERINT,
SPIDER_NET_GMCROVRINT,
SPIDER_NET_GMCRRNTINT,
SPIDER_NET_GMCRRXERINT,
SPIDER_NET_GTITCSERINT,
SPIDER_NET_GTIFMTERINT,
SPIDER_NET_GTIPKTRVKINT,
SPIDER_NET_GTISPINGINT,
SPIDER_NET_GTISADNGINT,
SPIDER_NET_GTISPDNGINT,
SPIDER_NET_GRIFMTERINT,
SPIDER_NET_GRIPKTRVKINT,
SPIDER_NET_GRISPINGINT,
SPIDER_NET_GRISADNGINT,
SPIDER_NET_GRISPDNGINT
};
#define SPIDER_NET_TXINT (1 << SPIDER_NET_GDTFDCINT)
/* We rely on flagged descriptor interrupts */
#define SPIDER_NET_RXINT ( (1 << SPIDER_NET_GDAFDCINT) )
#define SPIDER_NET_LINKINT ( 1 << SPIDER_NET_GMAC2INT )
#define SPIDER_NET_ERRINT ( 0xffffffff & \
(~SPIDER_NET_TXINT) & \
(~SPIDER_NET_RXINT) & \
(~SPIDER_NET_LINKINT) )
#define SPIDER_NET_GPREXEC 0x80000000
#define SPIDER_NET_GPRDAT_MASK 0x0000ffff
#define SPIDER_NET_DMAC_NOINTR_COMPLETE 0x00800000
#define SPIDER_NET_DMAC_TXFRMTL 0x00040000
#define SPIDER_NET_DMAC_TCP 0x00020000
#define SPIDER_NET_DMAC_UDP 0x00030000
#define SPIDER_NET_TXDCEST 0x08000000
#define SPIDER_NET_DESCR_RXFDIS 0x00000001
#define SPIDER_NET_DESCR_RXDCEIS 0x00000002
#define SPIDER_NET_DESCR_RXDEN0IS 0x00000004
#define SPIDER_NET_DESCR_RXINVDIS 0x00000008
#define SPIDER_NET_DESCR_RXRERRIS 0x00000010
#define SPIDER_NET_DESCR_RXFDCIMS 0x00000100
#define SPIDER_NET_DESCR_RXDCEIMS 0x00000200
#define SPIDER_NET_DESCR_RXDEN0IMS 0x00000400
#define SPIDER_NET_DESCR_RXINVDIMS 0x00000800
#define SPIDER_NET_DESCR_RXRERRMIS 0x00001000
#define SPIDER_NET_DESCR_UNUSED 0x077fe0e0
#define SPIDER_NET_DESCR_IND_PROC_MASK 0xF0000000
#define SPIDER_NET_DESCR_COMPLETE 0x00000000 /* used in rx and tx */
#define SPIDER_NET_DESCR_RESPONSE_ERROR 0x10000000 /* used in rx and tx */
#define SPIDER_NET_DESCR_PROTECTION_ERROR 0x20000000 /* used in rx and tx */
#define SPIDER_NET_DESCR_FRAME_END 0x40000000 /* used in rx */
#define SPIDER_NET_DESCR_FORCE_END 0x50000000 /* used in rx and tx */
#define SPIDER_NET_DESCR_CARDOWNED 0xA0000000 /* used in rx and tx */
#define SPIDER_NET_DESCR_NOT_IN_USE 0xF0000000
#define SPIDER_NET_DESCR_TXDESFLG 0x00800000
#define SPIDER_NET_DESCR_BAD_STATUS (SPIDER_NET_DESCR_RXDEN0IS | \
SPIDER_NET_DESCR_RXRERRIS | \
SPIDER_NET_DESCR_RXDEN0IMS | \
SPIDER_NET_DESCR_RXINVDIMS | \
SPIDER_NET_DESCR_RXRERRMIS | \
SPIDER_NET_DESCR_UNUSED)
/* Descriptor, as defined by the hardware */
struct spider_net_hw_descr {
u32 buf_addr;
u32 buf_size;
u32 next_descr_addr;
u32 dmac_cmd_status;
u32 result_size;
u32 valid_size; /* all zeroes for tx */
u32 data_status;
u32 data_error; /* all zeroes for tx */
} __attribute__((aligned(32)));
struct spider_net_descr {
struct spider_net_hw_descr *hwdescr;
struct sk_buff *skb;
u32 bus_addr;
struct spider_net_descr *next;
struct spider_net_descr *prev;
};
struct spider_net_descr_chain {
spinlock_t lock;
struct spider_net_descr *head;
struct spider_net_descr *tail;
struct spider_net_descr *ring;
int num_desc;
struct spider_net_hw_descr *hwring;
dma_addr_t dma_addr;
};
/* descriptor data_status bits */
#define SPIDER_NET_RX_IPCHK 29
#define SPIDER_NET_RX_TCPCHK 28
#define SPIDER_NET_VLAN_PACKET 21
#define SPIDER_NET_DATA_STATUS_CKSUM_MASK ( (1 << SPIDER_NET_RX_IPCHK) | \
(1 << SPIDER_NET_RX_TCPCHK) )
/* descriptor data_error bits */
#define SPIDER_NET_RX_IPCHKERR 27
#define SPIDER_NET_RX_RXTCPCHKERR 28
#define SPIDER_NET_DATA_ERR_CKSUM_MASK (1 << SPIDER_NET_RX_IPCHKERR)
/* the cases we don't pass the packet to the stack.
* 701b8000 would be correct, but every packets gets that flag */
#define SPIDER_NET_DESTROY_RX_FLAGS 0x700b8000
#define SPIDER_NET_DEFAULT_MSG ( NETIF_MSG_DRV | \
NETIF_MSG_PROBE | \
NETIF_MSG_LINK | \
NETIF_MSG_TIMER | \
NETIF_MSG_IFDOWN | \
NETIF_MSG_IFUP | \
NETIF_MSG_RX_ERR | \
NETIF_MSG_TX_ERR | \
NETIF_MSG_TX_QUEUED | \
NETIF_MSG_INTR | \
NETIF_MSG_TX_DONE | \
NETIF_MSG_RX_STATUS | \
NETIF_MSG_PKTDATA | \
NETIF_MSG_HW | \
NETIF_MSG_WOL )
struct spider_net_extra_stats {
unsigned long rx_desc_error;
unsigned long tx_timeouts;
unsigned long alloc_rx_skb_error;
unsigned long rx_iommu_map_error;
unsigned long tx_iommu_map_error;
unsigned long rx_desc_unk_state;
};
struct spider_net_card {
struct net_device *netdev;
struct pci_dev *pdev;
struct mii_phy phy;
struct napi_struct napi;
int medium;
void __iomem *regs;
struct spider_net_descr_chain tx_chain;
struct spider_net_descr_chain rx_chain;
struct spider_net_descr *low_watermark;
int aneg_count;
struct timer_list aneg_timer;
struct timer_list tx_timer;
struct work_struct tx_timeout_task;
atomic_t tx_timeout_task_counter;
wait_queue_head_t waitq;
int num_rx_ints;
int ignore_rx_ramfull;
/* for ethtool */
int msg_enable;
struct spider_net_extra_stats spider_stats;
/* Must be last item in struct */
struct spider_net_descr darray[];
};
#endif

View File

@ -1,174 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Network device driver for Cell Processor-Based Blade
*
* (C) Copyright IBM Corp. 2005
*
* Authors : Utz Bacher <utz.bacher@de.ibm.com>
* Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
*/
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/pci.h>
#include "spider_net.h"
static struct {
const char str[ETH_GSTRING_LEN];
} ethtool_stats_keys[] = {
{ "tx_packets" },
{ "tx_bytes" },
{ "rx_packets" },
{ "rx_bytes" },
{ "tx_errors" },
{ "tx_dropped" },
{ "rx_dropped" },
{ "rx_descriptor_error" },
{ "tx_timeouts" },
{ "alloc_rx_skb_error" },
{ "rx_iommu_map_error" },
{ "tx_iommu_map_error" },
{ "rx_desc_unk_state" },
};
static int
spider_net_ethtool_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{
struct spider_net_card *card;
card = netdev_priv(netdev);
ethtool_link_ksettings_zero_link_mode(cmd, supported);
ethtool_link_ksettings_add_link_mode(cmd, supported, 1000baseT_Full);
ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
ethtool_link_ksettings_zero_link_mode(cmd, advertising);
ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full);
ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);
cmd->base.port = PORT_FIBRE;
cmd->base.speed = card->phy.speed;
cmd->base.duplex = DUPLEX_FULL;
return 0;
}
static void
spider_net_ethtool_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{
struct spider_net_card *card;
card = netdev_priv(netdev);
/* clear and fill out info */
strscpy(drvinfo->driver, spider_net_driver_name,
sizeof(drvinfo->driver));
strscpy(drvinfo->version, VERSION, sizeof(drvinfo->version));
strscpy(drvinfo->fw_version, "no information",
sizeof(drvinfo->fw_version));
strscpy(drvinfo->bus_info, pci_name(card->pdev),
sizeof(drvinfo->bus_info));
}
static void
spider_net_ethtool_get_wol(struct net_device *netdev,
struct ethtool_wolinfo *wolinfo)
{
/* no support for wol */
wolinfo->supported = 0;
wolinfo->wolopts = 0;
}
static u32
spider_net_ethtool_get_msglevel(struct net_device *netdev)
{
struct spider_net_card *card;
card = netdev_priv(netdev);
return card->msg_enable;
}
static void
spider_net_ethtool_set_msglevel(struct net_device *netdev,
u32 level)
{
struct spider_net_card *card;
card = netdev_priv(netdev);
card->msg_enable = level;
}
static int
spider_net_ethtool_nway_reset(struct net_device *netdev)
{
if (netif_running(netdev)) {
spider_net_stop(netdev);
spider_net_open(netdev);
}
return 0;
}
static void
spider_net_ethtool_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ering,
struct kernel_ethtool_ringparam *kernel_ering,
struct netlink_ext_ack *extack)
{
struct spider_net_card *card = netdev_priv(netdev);
ering->tx_max_pending = SPIDER_NET_TX_DESCRIPTORS_MAX;
ering->tx_pending = card->tx_chain.num_desc;
ering->rx_max_pending = SPIDER_NET_RX_DESCRIPTORS_MAX;
ering->rx_pending = card->rx_chain.num_desc;
}
static int spider_net_get_sset_count(struct net_device *netdev, int sset)
{
switch (sset) {
case ETH_SS_STATS:
return ARRAY_SIZE(ethtool_stats_keys);
default:
return -EOPNOTSUPP;
}
}
static void spider_net_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct spider_net_card *card = netdev_priv(netdev);
data[0] = netdev->stats.tx_packets;
data[1] = netdev->stats.tx_bytes;
data[2] = netdev->stats.rx_packets;
data[3] = netdev->stats.rx_bytes;
data[4] = netdev->stats.tx_errors;
data[5] = netdev->stats.tx_dropped;
data[6] = netdev->stats.rx_dropped;
data[7] = card->spider_stats.rx_desc_error;
data[8] = card->spider_stats.tx_timeouts;
data[9] = card->spider_stats.alloc_rx_skb_error;
data[10] = card->spider_stats.rx_iommu_map_error;
data[11] = card->spider_stats.tx_iommu_map_error;
data[12] = card->spider_stats.rx_desc_unk_state;
}
static void spider_net_get_strings(struct net_device *netdev, u32 stringset,
u8 *data)
{
memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys));
}
const struct ethtool_ops spider_net_ethtool_ops = {
.get_drvinfo = spider_net_ethtool_get_drvinfo,
.get_wol = spider_net_ethtool_get_wol,
.get_msglevel = spider_net_ethtool_get_msglevel,
.set_msglevel = spider_net_ethtool_set_msglevel,
.get_link = ethtool_op_get_link,
.nway_reset = spider_net_ethtool_nway_reset,
.get_ringparam = spider_net_ethtool_get_ringparam,
.get_strings = spider_net_get_strings,
.get_sset_count = spider_net_get_sset_count,
.get_ethtool_stats = spider_net_get_ethtool_stats,
.get_link_ksettings = spider_net_ethtool_get_link_ksettings,
};