summaryrefslogtreecommitdiff
path: root/drivers/net/mv643xx_eth.c
AgeCommit message (Collapse)Author
2008-06-12mv643xx_eth: add tx rate controlLennert Buytenhek
Add an interface for the hardware's per-port and per-subqueue TX rate control. In this stage, this is mainly so that we can disable the bandwidth limits during initialisation of the port. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: general cleanupLennert Buytenhek
General cleanup of the mv643xx_eth driver. Mainly fixes coding style / indentation issues, get rid of some useless 'volatile's, kill some more superfluous comments, and such. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: remove write-only interrupt coalescing variablesLennert Buytenhek
Remove the write-only ->[rt]x_int_coal members from struct mv643xx_eth_private. In the process, tweak the RX/TX interrupt mitigation code so that it is compiled by default, and set the default coalescing delays to 0 usec. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: split out tx queue stateLennert Buytenhek
Split all TX queue related state into 'struct tx_queue', in preparation for multiple TX queue support. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: split out rx queue stateLennert Buytenhek
Split all RX queue related state into 'struct rx_queue', in preparation for multiple RX queue support. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: massively simplify multicast address crc8 computationLennert Buytenhek
Replace the 70-line crc8 computation (used for multicast address filtering tables) by a 5-line version. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: kill private unused instance of struct net_device_statsLennert Buytenhek
The per-port mv643xx_eth_private struct had a private instance of struct net_device_stats that was never ever written to, only read (via the ethtool statistics interface). This patch gets rid of the private instance, and tweaks the ethtool statistics code in mv643xx_eth to use the statistics in struct net_device instead. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: kill FUNC_RET_STATUS/pkt_infoLennert Buytenhek
Since they are no longer used, kill enum FUNC_RET_STATUS and struct pkt_info (which were a rather roundabout way of communicating RX/TX status within the same driver). Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: move rx_return_buff() into its only callerLennert Buytenhek
rx_return_buff() is also a remnant of the HAL layering that the original mv643xx_eth driver used. Moving it into its caller kills the last reference to FUNC_RET_STATUS/pkt_info. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: move port_receive() into its only callerLennert Buytenhek
The port_receive() function is a remnant of the original mv643xx_eth HAL split. This patch moves port_receive() into its caller, so that the top and the bottom half of RX processing no longer communicate via the HAL FUNC_RET_STATUS/pkt_info mechanism abstraction anymore. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: get rid of hungarian variable namingLennert Buytenhek
Nuke some Hungarian-esque variable naming conventions: - p_ prefix for pointers - _q suffix for variables dealing with rx/tx queue state Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: kill ->rx_resource_errLennert Buytenhek
The ->rx_resource_err variable doesn't serve a useful purpose -- kill it. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: kill superfluous commentsLennert Buytenhek
Half of the functions in the mv643xx_eth driver are prefixed by useless and baroque comment blocks on _what_ those functions do (which is obvious from the code itself) rather than why, and there's no point in keeping those comments around. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: use 'mv643xx_eth_' prefix consistentlyLennert Buytenhek
A bunch of places in the mv643xx_eth driver use the 'mv643xx_' prefix. Since the mv643xx is a chip that includes more than just ethernet, this patch makes all those places use either no prefix (for some internal-use-only functions), or the full 'mv643xx_eth_' prefix. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: get rid of ETH_/ethernet_/eth_ prefixesLennert Buytenhek
The fact that mv643xx_eth is an ethernet driver is pretty obvious, and having a lot of internal-use-only functions and defines prefixed with ETH_/ethernet_/eth_ prefixes is rather pointless. So, get rid of most of those prefixes. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: clean up rx/tx descriptor field definesLennert Buytenhek
Remove the unused rx/tx descriptor field defines, and move the ones that are actually used to the actual definitions of the rx/tx descriptor format. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: remove port serial status register bit definesLennert Buytenhek
All except one of the port serial status register bit defines are unused -- kill the unused ones. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: move MIB offset defines into their only userLennert Buytenhek
The only user of the ETH_MIB_VERY_LONG_NAME_HERE defines is the eth_update_mib_counters() function. Get rid of the defines by open-coding the register offsets in the latter. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: get rid of RX_BUF_OFFSETLennert Buytenhek
Get rid of RX_BUF_OFFSET (which is synonymous with ETH_HW_IP_ALIGN). Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: move PHY wait defines into callersLennert Buytenhek
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: clarify irq masking and unmaskingLennert Buytenhek
Replace the nondescriptive names ETH_INT_UNMASK_ALL and ETH_INT_UNMASK_ALL_EXT by names of the actual fields being masked and unmasked in the various writes to the interrupt mask registers. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: remove unused DESC_SIZE defineLennert Buytenhek
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: nuke port status register bit definesLennert Buytenhek
None of the port status register bit defines are ever used in the mv643xx_eth driver -- nuke them all. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: delete unused port serial control register bit definesLennert Buytenhek
Over half of the port serial control register bit defines are never used, and the PORT_SERIAL_CONTROL_DEFAULT_VALUE define is never used either. Keep only those defines that are actually used. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: delete unused SDMA config register bit definesLennert Buytenhek
Delete the defines for SDMA config register bit values that are never used in the driver, to tidy up the code some more. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: get rid of individual port config extend register bit definesLennert Buytenhek
The port config extend register is never changed at run time. Document the meaning of the initial value, and delete the defines for the individual bits in this register. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: get rid of individual port config register bit definesLennert Buytenhek
The mv643xx_eth driver only ever changes bit 0 of the port config register at run time, the rest of the register bits are fixed (and always zero). Document the meaning of the chosen default value, and get rid of all the defines for each of the individual bits. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: shorten reg namesLennert Buytenhek
Shorten the various oversized register names in mv643xx_eth.c, to increase readability. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: trim unnecessary includesLennert Buytenhek
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-06-12mv643xx_eth: reverse topological sort of functionsLennert Buytenhek
This patch performs a reverse topological sort of all functions in mv643xx_eth.c, so that we can get rid of all forward declarations, and end up with a more understandable driver due to related functions being grouped together. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-28mv643xx_eth: inter-mv643xx SMI port sharingLennert Buytenhek
There exist chips with up to four mv643xx_eth silicon blocks but only one external SMI (MII management) interface -- the SMI logic of the first block is shared by all the blocks. Handle this by allowing a per-port override of which mv643xx_eth_shared's SMI registers (and spinlock) to use. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Nicolas Pitre <nico@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-28mv643xx_eth: configurable t_clkLennert Buytenhek
Make t_clk configurable via platform device data (with the current hardcoded value, 133 MHz, being the default), as it varies across different chip families. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Nicolas Pitre <nico@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-28mv643xx_eth: mbus decode window supportLennert Buytenhek
Make it possible to pass mbus_dram_target_info to the mv643xx_eth driver via the platform data, and make the mv643xx_eth driver program the window registers based on this data if it is passed in. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-28mv643xx_eth: get rid of static variables, allow multiple instancesLennert Buytenhek
Move mv643xx_eth's static state (ethernet register block base address and MII management interface spinlock) into a struct hanging off the shared platform device. This is necessary to support chips that contain multiple mv643xx_eth silicon blocks. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Nicolas Pitre <nico@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-25net drivers: fix platform driver hotplug/coldplugKay Sievers
Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable network platform drivers, to re-enable auto loading. NOTE: didn't change drivers/net/fs_enet/fs_enet-main.c "old binding" support. That looks problematic in the first place (it even uses the ancient "struct device_driver" binding scheme for platform_bus!) and I suspect it will vanish soonish when arch/powerpc rules the world. Also, drivers/net/ne.c would have needed more thought to sort out. [akpm@linux-foundation.org: fix sgiseeq.c] [dbrownell@users.sourceforge.net: more drivers, registration fixes] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Scott Wood <scottwood@freescale.com> Cc: Vitaly Bordug <vitb@kernel.crashing.org> Cc: Dale Farnsworth <dale@farnsworth.org> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Andrew Victor <andrew@sanpeople.com> Cc: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-16mv643xx_eth: update copyrightLennert Buytenhek
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-16mv643xx_eth: only print banner onceLennert Buytenhek
When there are multiple mv643xx_eth silicon blocks in the system, don't print an initialisation message for each and every one of them. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-16mv643xx_eth: pass port identifier to register accessorsLennert Buytenhek
Pass a struct mv643xx_private * to the register accessor functions, as a preparation for having multiple mv643xx_eth silicon blocks. (Since this causes some 80 column straddling, and the mv_ prefix is useless anyway, rename mv_read to rdl and mv_write to wrl to compensate.) Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-16mv643xx_eth: report netdev name in all printksLennert Buytenhek
In error and warning printks, always report the netdevice name instead of the port index (the latter has no meaning when there are multiple mv643xx_eth silicon blocks in the system.) Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-16mv643xx_eth: identify ports by struct mv643xx_private *Lennert Buytenhek
Instead of identifying individual mv643xx ethernet ports by only their port number, identify them by their struct mv643xx_private *, as just a port number has no meaning when there are multiple mv643xx_eth silicon blocks in the system. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-16mv643xx_eth: various cleanupsLennert Buytenhek
- Remove unused MV643XX_DEFAULT_[RT]X_QUEUE_SIZE definitions. - Remove ETH_TARGET enum -- it isn't used anywhere in the driver, and isn't even valid for non-mv643xx chip models, as those use different MBUS target IDs. - Clean up comment and control flow in mv643xx_eth_change_mtu(). - Use mp->dev instead of mp->mii.dev in mv643xx_eth_tx_timeout_task(). - Make mv643xx_eth_free_tx_descs() static. - Remove overzealous NULL check in mv643xx_eth_start_xmit(). - Use symbolic NETDEV_TX_* constants in mv643xx_eth_start_xmit(). Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-04-16mv643xx_eth: mp->tx_desc_count needs spinlock protectionLennert Buytenhek
mv643xx_eth_start_xmit() should check mp->tx_desc_count only inside the mp->lock spinlock. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2008-03-26drivers/net/mv643xx_eth.c: Use FIELD_SIZEOFJulia Lawall
Robert P.J. Day proposed to use the macro FIELD_SIZEOF in replace of code that matches its definition. The modification was made using the following semantic patch (http://www.emn.fr/x-info/coccinelle/) // <smpl> @haskernel@ @@ #include <linux/kernel.h> @depends on haskernel@ type t; identifier f; @@ - (sizeof(((t*)0)->f)) + FIELD_SIZEOF(t, f) @depends on haskernel@ type t; identifier f; @@ - sizeof(((t*)0)->f) + FIELD_SIZEOF(t, f) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-03-05mv643xx_eth: Define module alias for platform deviceMartin Michlmayr
The mv643xx_eth driver can be loaded as a platform device, as is done by various Orion (ARM) based devices. The driver needs to define a module alias for the platform driver so udev will load it automatically. Tested with Debian on a QNAP TS-209. Signed-off-by: Martin Michlmayr <tbm@cyrius.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-05mv643xx_eth: fix byte order when checksum offload is enabledByron Bradley
The Marvell Orion system on chips have an integrated mv643xx MAC. On these little endian ARM devices mv643xx will oops when checksum offload is enabled. Swapping the byte order of the protocol and checksum solves this problem. Signed-off-by: Byron Bradley <byron.bbradley@gmail.com> Cc: Dale Farnsworth <dale@farnsworth.org> Cc: Manish Lachwani <mlachwani@mvista.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-23Merge branch 'features' of git://farnsworth.org/dale/linux-2.6-mv643xx_eth ↵Jeff Garzik
into upstream
2007-10-23mv643xx_eth: Hook up mv643xx_get_sset_countDale Farnsworth
Commit b9f2c044 replaced mv643xx_get_stats_count() with mv643xx_get_sset_count(), but forgot to hook it up. drivers/net/mv643xx_eth.c:2678: warning: mv643xx_get_sset_count defined but not used Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2007-10-23mv643xx_eth: Remove obsolete checksum offload commentDale Farnsworth
We fixed checksum offload a while back. Remove the note that it doesn't work. Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2007-10-23mv643xx_eth: Merge drivers/net/mv643xx_eth.h into mv643xx_eth.cLennert Buytenhek
Since drivers/net/mv643xx_eth.c is the only user of drivers/net/mv643xx_eth.h, there's not much use in having the header file as a separate file, so merge the header into the driver. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
2007-10-23mv643xx_eth: Remove MV643XX_ETH_ register prefixLennert Buytenhek
Now that all register address and bit defines are in private namespace (drivers/net/mv643xx_eth.h), we can safely remove the MV643XX_ETH_ prefix to conserve horizontal space. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>