drivers/net/ethernet/3com/3c59x.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/3com/3c59x.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/3com/3c59x.c
Extension
.c
Size
104591 bytes
Lines
3358
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct net_device_ops boomrang_netdev_ops = {
	.ndo_open		= vortex_open,
	.ndo_stop		= vortex_close,
	.ndo_start_xmit		= boomerang_start_xmit,
	.ndo_tx_timeout		= vortex_tx_timeout,
	.ndo_get_stats		= vortex_get_stats,
#ifdef CONFIG_PCI
	.ndo_eth_ioctl		= vortex_ioctl,
#endif
	.ndo_set_rx_mode	= set_rx_mode,
	.ndo_set_mac_address 	= eth_mac_addr,
	.ndo_validate_addr	= eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
	.ndo_poll_controller	= poll_vortex,
#endif
};

static const struct net_device_ops vortex_netdev_ops = {
	.ndo_open		= vortex_open,
	.ndo_stop		= vortex_close,
	.ndo_start_xmit		= vortex_start_xmit,
	.ndo_tx_timeout		= vortex_tx_timeout,
	.ndo_get_stats		= vortex_get_stats,
#ifdef CONFIG_PCI
	.ndo_eth_ioctl		= vortex_ioctl,
#endif
	.ndo_set_rx_mode	= set_rx_mode,
	.ndo_set_mac_address 	= eth_mac_addr,
	.ndo_validate_addr	= eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
	.ndo_poll_controller	= poll_vortex,
#endif
};

/*
 * Start up the PCI/EISA device which is described by *gendev.
 * Return 0 on success.
 *
 * NOTE: pdev can be NULL, for the case of a Compaq device
 */
static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
			 int chip_idx, int card_idx)
{
	struct vortex_private *vp;
	int option;
	unsigned int eeprom[0x40], checksum = 0;		/* EEPROM contents */
	__be16 addr[ETH_ALEN / 2];
	int i, step;
	struct net_device *dev;
	static int printed_version;
	int retval, print_info;
	struct vortex_chip_info * const vci = &vortex_info_tbl[chip_idx];
	const char *print_name = "3c59x";
	struct pci_dev *pdev = NULL;
	struct eisa_device *edev = NULL;

	if (!printed_version) {
		pr_info("%s", version);
		printed_version = 1;
	}

	if (gendev) {
		if ((pdev = DEVICE_PCI(gendev))) {
			print_name = pci_name(pdev);
		}

		if ((edev = DEVICE_EISA(gendev))) {
			print_name = dev_name(&edev->dev);
		}
	}

	dev = alloc_etherdev(sizeof(*vp));
	retval = -ENOMEM;
	if (!dev)
		goto out;

	SET_NETDEV_DEV(dev, gendev);
	vp = netdev_priv(dev);

	option = global_options;

	/* The lower four bits are the media type. */
	if (dev->mem_start) {
		/*
		 * The 'options' param is passed in as the third arg to the
		 * LILO 'ether=' argument for non-modular use
		 */
		option = dev->mem_start;
	}
	else if (card_idx < MAX_UNITS) {

Annotation

Implementation Notes