linux/drivers/net/ethernet/realtek/8139cp.c

/* 8139cp.c: A Linux PCI Ethernet driver for the RealTek 8139C+ chips. */
/*
	Copyright 2001-2004 Jeff Garzik <[email protected]>

	Copyright (C) 2001, 2002 David S. Miller ([email protected]) [tg3.c]
	Copyright (C) 2000, 2001 David S. Miller ([email protected]) [sungem.c]
	Copyright 2001 Manfred Spraul				    [natsemi.c]
	Copyright 1999-2001 by Donald Becker.			    [natsemi.c]
	Written 1997-2001 by Donald Becker.			    [8139too.c]
	Copyright 1998-2001 by Jes Sorensen, <[email protected]>. [acenic.c]

	This software may be used and distributed according to the terms of
	the GNU General Public License (GPL), incorporated herein by reference.
	Drivers based on or derived from this code fall under the GPL and must
	retain the authorship, copyright and license notice.  This file is not
	a complete program and may only be used when the entire operating
	system is licensed under the GPL.

	See the file COPYING in this distribution for more information.

	Contributors:

		Wake-on-LAN support - Felipe Damasio <[email protected]>
		PCI suspend/resume  - Felipe Damasio <[email protected]>
		LinkChg interrupt   - Felipe Damasio <[email protected]>

	TODO:
	* Test Tx checksumming thoroughly

	Low priority TODO:
	* Complete reset on PciErr
	* Consider Rx interrupt mitigation using TimerIntr
	* Investigate using skb->priority with h/w VLAN priority
	* Investigate using High Priority Tx Queue with skb->priority
	* Adjust Rx FIFO threshold and Max Rx DMA burst on Rx FIFO error
	* Adjust Tx FIFO threshold and Max Tx DMA burst on Tx FIFO error
	* Implement Tx software interrupt mitigation via
	  Tx descriptor bit
	* The real minimum of CP_MIN_MTU is 4 bytes.  However,
	  for this to be supported, one must(?) turn on packet padding.
	* Support external MII transceivers (patch available)

	NOTES:
	* TX checksumming is considered experimental.  It is off by
	  default, use ethtool to turn it on.

 */

#define pr_fmt(fmt)

#define DRV_NAME
#define DRV_VERSION
#define DRV_RELDATE


#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/gfp.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/cache.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <linux/uaccess.h>

/* These identify the driver base version and may not be removed. */
static char version[] =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();

static int debug =;
module_param(debug, int, 0);
MODULE_PARM_DESC();

/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
   The RTL chips use a 64 element hash table based on the Ethernet CRC.  */
static int multicast_filter_limit =;
module_param(multicast_filter_limit, int, 0);
MODULE_PARM_DESC();

#define CP_DEF_MSG_ENABLE
#define CP_NUM_STATS
#define CP_STATS_SIZE
#define CP_REGS_SIZE
#define CP_REGS_VER
#define CP_RX_RING_SIZE
#define CP_TX_RING_SIZE
#define CP_RING_BYTES
#define NEXT_TX(N)
#define NEXT_RX(N)
#define TX_BUFFS_AVAIL(CP)

#define PKT_BUF_SZ
#define CP_INTERNAL_PHY

/* The following settings are log_2(bytes)-4:  0 == 16 bytes .. 6==1024, 7==end of packet. */
#define RX_FIFO_THRESH
#define RX_DMA_BURST
#define TX_DMA_BURST
#define TX_EARLY_THRESH

/* Time in jiffies before concluding the transmitter is hung. */
#define TX_TIMEOUT

/* hardware minimum and maximum for a single frame's data payload */
#define CP_MIN_MTU
#define CP_MAX_MTU

enum {};

static const unsigned int cp_rx_config =;

struct cp_desc {};

struct cp_dma_stats {} __packed;

struct cp_extra_stats {};

struct cp_private {};

#define cpr8(reg)
#define cpr16(reg)
#define cpr32(reg)
#define cpw8(reg,val)
#define cpw16(reg,val)
#define cpw32(reg,val)
#define cpw8_f(reg,val)
#define cpw16_f(reg,val)
#define cpw32_f(reg,val)


static void __cp_set_rx_mode (struct net_device *dev);
static void cp_tx (struct cp_private *cp);
static void cp_clean_rings (struct cp_private *cp);
#ifdef CONFIG_NET_POLL_CONTROLLER
static void cp_poll_controller(struct net_device *dev);
#endif
static int cp_get_eeprom_len(struct net_device *dev);
static int cp_get_eeprom(struct net_device *dev,
			 struct ethtool_eeprom *eeprom, u8 *data);
static int cp_set_eeprom(struct net_device *dev,
			 struct ethtool_eeprom *eeprom, u8 *data);

static struct {} ethtool_stats_keys[] =;


static inline void cp_set_rxbufsize (struct cp_private *cp)
{}

static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
			      struct cp_desc *desc)
{}

static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail,
			    u32 status, u32 len)
{}

static inline unsigned int cp_rx_csum_ok (u32 status)
{}

static int cp_rx_poll(struct napi_struct *napi, int budget)
{}

static irqreturn_t cp_interrupt (int irq, void *dev_instance)
{}

#ifdef CONFIG_NET_POLL_CONTROLLER
/*
 * Polling receive - used by netconsole and other diagnostic tools
 * to allow network i/o with interrupts disabled.
 */
static void cp_poll_controller(struct net_device *dev)
{}
#endif

static void cp_tx (struct cp_private *cp)
{}

static inline u32 cp_tx_vlan_tag(struct sk_buff *skb)
{}

static void unwind_tx_frag_mapping(struct cp_private *cp, struct sk_buff *skb,
				   int first, int entry_last)
{}

static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
					struct net_device *dev)
{}

/* Set or clear the multicast filter for this adaptor.
   This routine is not state sensitive and need not be SMP locked. */

static void __cp_set_rx_mode (struct net_device *dev)
{}

static void cp_set_rx_mode (struct net_device *dev)
{}

static void __cp_get_stats(struct cp_private *cp)
{}

static struct net_device_stats *cp_get_stats(struct net_device *dev)
{}

static void cp_stop_hw (struct cp_private *cp)
{}

static void cp_reset_hw (struct cp_private *cp)
{}

static inline void cp_start_hw (struct cp_private *cp)
{}

static void cp_enable_irq(struct cp_private *cp)
{}

static void cp_init_hw (struct cp_private *cp)
{}

static int cp_refill_rx(struct cp_private *cp)
{}

static void cp_init_rings_index (struct cp_private *cp)
{}

static int cp_init_rings (struct cp_private *cp)
{}

static int cp_alloc_rings (struct cp_private *cp)
{}

static void cp_clean_rings (struct cp_private *cp)
{}

static void cp_free_rings (struct cp_private *cp)
{}

static int cp_open (struct net_device *dev)
{}

static int cp_close (struct net_device *dev)
{}

static void cp_tx_timeout(struct net_device *dev, unsigned int txqueue)
{}

static int cp_change_mtu(struct net_device *dev, int new_mtu)
{}

static const char mii_2_8139_map[8] =;

static int mdio_read(struct net_device *dev, int phy_id, int location)
{}


static void mdio_write(struct net_device *dev, int phy_id, int location,
		       int value)
{}

/* Set the ethtool Wake-on-LAN settings */
static int netdev_set_wol (struct cp_private *cp,
			   const struct ethtool_wolinfo *wol)
{}

/* Get the ethtool Wake-on-LAN settings */
static void netdev_get_wol (struct cp_private *cp,
	             struct ethtool_wolinfo *wol)
{}

static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
{}

static void cp_get_ringparam(struct net_device *dev,
			     struct ethtool_ringparam *ring,
			     struct kernel_ethtool_ringparam *kernel_ring,
			     struct netlink_ext_ack *extack)
{}

static int cp_get_regs_len(struct net_device *dev)
{}

static int cp_get_sset_count (struct net_device *dev, int sset)
{}

static int cp_get_link_ksettings(struct net_device *dev,
				 struct ethtool_link_ksettings *cmd)
{}

static int cp_set_link_ksettings(struct net_device *dev,
				 const struct ethtool_link_ksettings *cmd)
{}

static int cp_nway_reset(struct net_device *dev)
{}

static u32 cp_get_msglevel(struct net_device *dev)
{}

static void cp_set_msglevel(struct net_device *dev, u32 value)
{}

static int cp_set_features(struct net_device *dev, netdev_features_t features)
{}

static void cp_get_regs(struct net_device *dev, struct ethtool_regs *regs,
		        void *p)
{}

static void cp_get_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static int cp_set_wol (struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static void cp_get_strings (struct net_device *dev, u32 stringset, u8 *buf)
{}

static void cp_get_ethtool_stats (struct net_device *dev,
				  struct ethtool_stats *estats, u64 *tmp_stats)
{}

static const struct ethtool_ops cp_ethtool_ops =;

static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{}

static int cp_set_mac_address(struct net_device *dev, void *p)
{}

/* Serial EEPROM section. */

/*  EEPROM_Ctrl bits. */
#define EE_SHIFT_CLK
#define EE_CS
#define EE_DATA_WRITE
#define EE_WRITE_0
#define EE_WRITE_1
#define EE_DATA_READ
#define EE_ENB

/* Delay between EEPROM clock transitions.
   No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
 */

#define eeprom_delay()

/* The EEPROM commands include the alway-set leading bit. */
#define EE_EXTEND_CMD
#define EE_WRITE_CMD
#define EE_READ_CMD
#define EE_ERASE_CMD

#define EE_EWDS_ADDR
#define EE_WRAL_ADDR
#define EE_ERAL_ADDR
#define EE_EWEN_ADDR

#define CP_EEPROM_MAGIC

static void eeprom_cmd_start(void __iomem *ee_addr)
{}

static void eeprom_cmd(void __iomem *ee_addr, int cmd, int cmd_len)
{}

static void eeprom_cmd_end(void __iomem *ee_addr)
{}

static void eeprom_extend_cmd(void __iomem *ee_addr, int extend_cmd,
			      int addr_len)
{}

static u16 read_eeprom (void __iomem *ioaddr, int location, int addr_len)
{}

static void write_eeprom(void __iomem *ioaddr, int location, u16 val,
			 int addr_len)
{}

static int cp_get_eeprom_len(struct net_device *dev)
{}

static int cp_get_eeprom(struct net_device *dev,
			 struct ethtool_eeprom *eeprom, u8 *data)
{}

static int cp_set_eeprom(struct net_device *dev,
			 struct ethtool_eeprom *eeprom, u8 *data)
{}

/* Put the board into D3cold state and wait for WakeUp signal */
static void cp_set_d3_state (struct cp_private *cp)
{}

static netdev_features_t cp_features_check(struct sk_buff *skb,
					   struct net_device *dev,
					   netdev_features_t features)
{}
static const struct net_device_ops cp_netdev_ops =;

static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{}

static void cp_remove_one (struct pci_dev *pdev)
{}

static int __maybe_unused cp_suspend(struct device *device)
{}

static int __maybe_unused cp_resume(struct device *device)
{}

static const struct pci_device_id cp_pci_tbl[] =;
MODULE_DEVICE_TABLE(pci, cp_pci_tbl);

static SIMPLE_DEV_PM_OPS(cp_pm_ops, cp_suspend, cp_resume);

static struct pci_driver cp_driver =;

module_pci_driver();