X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fnet%2Ffealnx.c;h=daf7272c335260c2b2ac6edffbb3929ef7322edf;hb=fbf978914e8fbc804ddbd68550bb2c7d14b2049d;hp=191bd429076aacc9efefdf9f86ba70024fcc540b;hpb=7282d491ecaee9883233a0e27283c4c79486279a;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 191bd42..daf7272 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c @@ -90,6 +90,7 @@ static int full_duplex[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 }; #include /* Processor type for cache alignment. */ #include #include +#include /* These identify the driver base version and may not be removed. */ static char version[] = @@ -111,7 +112,6 @@ MODULE_AUTHOR("Myson or whoever"); MODULE_DESCRIPTION("Myson MTD-8xx 100/10M Ethernet PCI Adapter Driver"); MODULE_LICENSE("GPL"); module_param(max_interrupt_work, int, 0); -//MODULE_PARM(min_pci_latency, "i"); module_param(debug, int, 0); module_param(rx_copybreak, int, 0); module_param(multicast_filter_limit, int, 0); @@ -431,10 +431,10 @@ static void getlinktype(struct net_device *dev); static void getlinkstatus(struct net_device *dev); static void netdev_timer(unsigned long data); static void reset_timer(unsigned long data); -static void tx_timeout(struct net_device *dev); +static void fealnx_tx_timeout(struct net_device *dev); static void init_ring(struct net_device *dev); static int start_tx(struct sk_buff *skb, struct net_device *dev); -static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t intr_handler(int irq, void *dev_instance); static int netdev_rx(struct net_device *dev); static void set_rx_mode(struct net_device *dev); static void __set_rx_mode(struct net_device *dev); @@ -467,6 +467,18 @@ static void stop_nic_rxtx(void __iomem *ioaddr, long crvalue) } } +static const struct net_device_ops netdev_ops = { + .ndo_open = netdev_open, + .ndo_stop = netdev_close, + .ndo_start_xmit = start_tx, + .ndo_get_stats = get_stats, + .ndo_set_multicast_list = set_rx_mode, + .ndo_do_ioctl = mii_ioctl, + .ndo_tx_timeout = fealnx_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; static int __devinit fealnx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -527,7 +539,6 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev, err = -ENOMEM; goto err_out_unmap; } - SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); /* read ethernet id */ @@ -650,26 +661,17 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev, np->mii.force_media = 1; } - /* The chip-specific entries in the device structure. */ - dev->open = &netdev_open; - dev->hard_start_xmit = &start_tx; - dev->stop = &netdev_close; - dev->get_stats = &get_stats; - dev->set_multicast_list = &set_rx_mode; - dev->do_ioctl = &mii_ioctl; + dev->netdev_ops = &netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; - dev->tx_timeout = &tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; err = register_netdev(dev); if (err) goto err_out_free_tx; - printk(KERN_INFO "%s: %s at %p, ", - dev->name, skel_netdrv_tbl[chip_id].chip_name, ioaddr); - for (i = 0; i < 5; i++) - printk("%2.2x:", dev->dev_addr[i]); - printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); + printk(KERN_INFO "%s: %s at %p, %pM, IRQ %d.\n", + dev->name, skel_netdrv_tbl[chip_id].chip_name, ioaddr, + dev->dev_addr, irq); return 0; @@ -864,40 +866,20 @@ static int netdev_open(struct net_device *dev) Wait the specified 50 PCI cycles after a reset by initializing Tx and Rx queues and the address filter list. FIXME (Ueimor): optimistic for alpha + posted writes ? */ -#if defined(__powerpc__) || defined(__sparc__) -// 89/9/1 modify, -// np->bcrvalue=0x04 | 0x0x38; /* big-endian, 256 burst length */ - np->bcrvalue = 0x04 | 0x10; /* big-endian, tx 8 burst length */ - np->crvalue = 0xe00; /* rx 128 burst length */ -#elif defined(__alpha__) || defined(__x86_64__) -// 89/9/1 modify, -// np->bcrvalue=0x38; /* little-endian, 256 burst length */ - np->bcrvalue = 0x10; /* little-endian, 8 burst length */ - np->crvalue = 0xe00; /* rx 128 burst length */ -#elif defined(__i386__) -#if defined(MODULE) -// 89/9/1 modify, -// np->bcrvalue=0x38; /* little-endian, 256 burst length */ + np->bcrvalue = 0x10; /* little-endian, 8 burst length */ - np->crvalue = 0xe00; /* rx 128 burst length */ -#else - /* When not a module we can work around broken '486 PCI boards. */ -#define x86 boot_cpu_data.x86 -// 89/9/1 modify, -// np->bcrvalue=(x86 <= 4 ? 0x10 : 0x38); - np->bcrvalue = 0x10; - np->crvalue = (x86 <= 4 ? 0xa00 : 0xe00); - if (x86 <= 4) - printk(KERN_INFO "%s: This is a 386/486 PCI system, setting burst " - "length to %x.\n", dev->name, (x86 <= 4 ? 0x10 : 0x38)); +#ifdef __BIG_ENDIAN + np->bcrvalue |= 0x04; /* big-endian */ #endif -#else -// 89/9/1 modify, -// np->bcrvalue=0x38; - np->bcrvalue = 0x10; - np->crvalue = 0xe00; /* rx 128 burst length */ -#warning Processor architecture undefined! + +#if defined(__i386__) && !defined(MODULE) + if (boot_cpu_data.x86 <= 4) + np->crvalue = 0xa00; + else #endif + np->crvalue = 0xe00; /* rx 128 burst length */ + + // 89/12/29 add, // 90/1/16 modify, // np->imrvalue=FBE|TUNF|CNTOVF|RBU|TI|RI; @@ -1220,7 +1202,7 @@ static void reset_timer(unsigned long data) } -static void tx_timeout(struct net_device *dev) +static void fealnx_tx_timeout(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); void __iomem *ioaddr = np->mem; @@ -1453,7 +1435,7 @@ static void reset_rx_descriptors(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t intr_handler(int irq, void *dev_instance) { struct net_device *dev = (struct net_device *) dev_instance; struct netdev_private *np = netdev_priv(dev); @@ -1719,7 +1701,6 @@ static int netdev_rx(struct net_device *dev) to a minimally-sized skbuff. */ if (pkt_len < rx_copybreak && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { - skb->dev = dev; skb_reserve(skb, 2); /* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(np->pci_dev, np->cur_rx->buffer, @@ -1728,8 +1709,8 @@ static int netdev_rx(struct net_device *dev) /* Call copy + cksum if available. */ #if ! defined(__alpha__) - eth_copy_and_sum(skb, - np->cur_rx->skbuff->data, pkt_len, 0); + skb_copy_to_linear_data(skb, + np->cur_rx->skbuff->data, pkt_len); skb_put(skb, pkt_len); #else memcpy(skb_put(skb, pkt_len), @@ -1750,7 +1731,6 @@ static int netdev_rx(struct net_device *dev) } skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - dev->last_rx = jiffies; np->stats.rx_packets++; np->stats.rx_bytes += pkt_len; } @@ -1893,8 +1873,6 @@ static const struct ethtool_ops netdev_ethtool_ops = { .get_link = netdev_get_link, .get_msglevel = netdev_get_msglevel, .set_msglevel = netdev_set_msglevel, - .get_sg = ethtool_op_get_sg, - .get_tx_csum = ethtool_op_get_tx_csum, }; static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)