Commit a4a07102 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://gkernel.bkbits.net/net-drivers-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents e83a3797 99e82596
D-Link DL2000-based Gigabit Ethernet Adapter Installation D-Link DL2000-based Gigabit Ethernet Adapter Installation
for Linux for Linux
Jan 02, 2002 Jan 29, 2002
Contents Contents
======== ========
...@@ -199,8 +199,8 @@ media=media_type - Specifies the media type the NIC operates at. ...@@ -199,8 +199,8 @@ media=media_type - Specifies the media type the NIC operates at.
6 1000Mbps full duplex. 6 1000Mbps full duplex.
By default, the NIC operates at autosense. By default, the NIC operates at autosense.
Note that only 1000mbps_fd and 1000mbps_hd 1000mbps_fd and 1000mbps_hd types are only
types are available for fiber adapter. available for fiber adapter.
vlan=[0|1] - Specifies the VLAN ID. If vlan=0, the vlan=[0|1] - Specifies the VLAN ID. If vlan=0, the
Virtual Local Area Network (VLAN) function is Virtual Local Area Network (VLAN) function is
......
...@@ -263,13 +263,13 @@ el2_probe1(struct net_device *dev, int ioaddr) ...@@ -263,13 +263,13 @@ el2_probe1(struct net_device *dev, int ioaddr)
#endif /* EL2MEMTEST */ #endif /* EL2MEMTEST */
if (dev->mem_start) if (dev->mem_start)
dev->mem_end = dev->rmem_end = dev->mem_start + EL2_MEMSIZE; dev->mem_end = ei_status.rmem_end = dev->mem_start + EL2_MEMSIZE;
if (wordlength) { /* No Tx pages to skip over to get to Rx */ if (wordlength) { /* No Tx pages to skip over to get to Rx */
dev->rmem_start = dev->mem_start; ei_status.rmem_start = dev->mem_start;
ei_status.name = "3c503/16"; ei_status.name = "3c503/16";
} else { } else {
dev->rmem_start = TX_PAGES*256 + dev->mem_start; ei_status.rmem_start = TX_PAGES*256 + dev->mem_start;
ei_status.name = "3c503"; ei_status.name = "3c503";
} }
} }
...@@ -549,7 +549,7 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring ...@@ -549,7 +549,7 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring
unsigned short int *buf; unsigned short int *buf;
unsigned short word; unsigned short word;
int end_of_ring = dev->rmem_end; int end_of_ring = ei_status.rmem_end;
/* Maybe enable shared memory just be to be safe... nahh.*/ /* Maybe enable shared memory just be to be safe... nahh.*/
if (dev->mem_start) { /* Use the shared memory. */ if (dev->mem_start) { /* Use the shared memory. */
...@@ -559,7 +559,7 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring ...@@ -559,7 +559,7 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring
int semi_count = end_of_ring - (dev->mem_start + ring_offset); int semi_count = end_of_ring - (dev->mem_start + ring_offset);
isa_memcpy_fromio(skb->data, dev->mem_start + ring_offset, semi_count); isa_memcpy_fromio(skb->data, dev->mem_start + ring_offset, semi_count);
count -= semi_count; count -= semi_count;
isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count); isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
} else { } else {
/* Packet is in one chunk -- we can copy + cksum. */ /* Packet is in one chunk -- we can copy + cksum. */
isa_eth_io_copy_and_sum(skb, dev->mem_start + ring_offset, count, 0); isa_eth_io_copy_and_sum(skb, dev->mem_start + ring_offset, count, 0);
......
...@@ -1383,7 +1383,7 @@ static inline void elp_init(struct net_device *dev) ...@@ -1383,7 +1383,7 @@ static inline void elp_init(struct net_device *dev)
/* /*
* memory information * memory information
*/ */
dev->mem_start = dev->mem_end = dev->rmem_end = dev->rmem_start = 0; dev->mem_start = dev->mem_end = 0;
} }
/************************************************************ /************************************************************
......
...@@ -51,8 +51,6 @@ extern int ei_open(struct net_device *dev); ...@@ -51,8 +51,6 @@ extern int ei_open(struct net_device *dev);
extern int ei_close(struct net_device *dev); extern int ei_close(struct net_device *dev);
extern void ei_interrupt(int irq, void *dev_id, struct pt_regs *regs); extern void ei_interrupt(int irq, void *dev_id, struct pt_regs *regs);
/* Most of these entries should be in 'struct net_device' (or most of the
things in there should be here!) */
/* You have one of these per-board */ /* You have one of these per-board */
struct ei_device { struct ei_device {
const char *name; const char *name;
...@@ -60,6 +58,8 @@ struct ei_device { ...@@ -60,6 +58,8 @@ struct ei_device {
void (*get_8390_hdr)(struct net_device *, struct e8390_pkt_hdr *, int); void (*get_8390_hdr)(struct net_device *, struct e8390_pkt_hdr *, int);
void (*block_output)(struct net_device *, int, const unsigned char *, int); void (*block_output)(struct net_device *, int, const unsigned char *, int);
void (*block_input)(struct net_device *, int, struct sk_buff *, int); void (*block_input)(struct net_device *, int, struct sk_buff *, int);
unsigned long rmem_start;
unsigned long rmem_end;
unsigned char mcfilter[8]; unsigned char mcfilter[8];
unsigned open:1; unsigned open:1;
unsigned word16:1; /* We have the 16-bit (vs 8-bit) version of the card. */ unsigned word16:1; /* We have the 16-bit (vs 8-bit) version of the card. */
......
...@@ -57,6 +57,9 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then ...@@ -57,6 +57,9 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
if [ "$CONFIG_MIPS_AU1000" = "y" ]; then if [ "$CONFIG_MIPS_AU1000" = "y" ]; then
bool ' MIPS AU1000 Ethernet support' CONFIG_MIPS_AU1000_ENET bool ' MIPS AU1000 Ethernet support' CONFIG_MIPS_AU1000_ENET
fi fi
if [ "$CONFIG_SIBYTE_SB1250" = "y" ]; then
tristate ' SB1250 Ethernet support' CONFIG_NET_SB1250_MAC
fi
if [ "$CONFIG_SGI_IP27" = "y" ]; then if [ "$CONFIG_SGI_IP27" = "y" ]; then
bool ' SGI IOC3 Ethernet' CONFIG_SGI_IOC3_ETH bool ' SGI IOC3 Ethernet' CONFIG_SGI_IOC3_ETH
fi fi
......
...@@ -82,6 +82,7 @@ obj-$(CONFIG_NS83820) += ns83820.o ...@@ -82,6 +82,7 @@ obj-$(CONFIG_NS83820) += ns83820.o
obj-$(CONFIG_STNIC) += stnic.o 8390.o obj-$(CONFIG_STNIC) += stnic.o 8390.o
obj-$(CONFIG_FEALNX) += fealnx.o mii.o obj-$(CONFIG_FEALNX) += fealnx.o mii.o
obj-$(CONFIG_TIGON3) += tg3.o obj-$(CONFIG_TIGON3) += tg3.o
obj-$(CONFIG_TC35815) += tc35815.o
ifeq ($(CONFIG_SK98LIN),y) ifeq ($(CONFIG_SK98LIN),y)
obj-y += sk98lin/sk98lin.o obj-y += sk98lin/sk98lin.o
...@@ -133,6 +134,7 @@ obj-$(CONFIG_E2100) += e2100.o 8390.o ...@@ -133,6 +134,7 @@ obj-$(CONFIG_E2100) += e2100.o 8390.o
obj-$(CONFIG_ES3210) += es3210.o 8390.o obj-$(CONFIG_ES3210) += es3210.o 8390.o
obj-$(CONFIG_LNE390) += lne390.o 8390.o obj-$(CONFIG_LNE390) += lne390.o 8390.o
obj-$(CONFIG_NE3210) += ne3210.o 8390.o obj-$(CONFIG_NE3210) += ne3210.o 8390.o
obj-$(CONFIG_NET_SB1250_MAC) += sb1250-mac.o
obj-$(CONFIG_PPP) += ppp_generic.o slhc.o obj-$(CONFIG_PPP) += ppp_generic.o slhc.o
obj-$(CONFIG_PPP_ASYNC) += ppp_async.o obj-$(CONFIG_PPP_ASYNC) += ppp_async.o
...@@ -153,6 +155,7 @@ obj-$(CONFIG_DE600) += de600.o ...@@ -153,6 +155,7 @@ obj-$(CONFIG_DE600) += de600.o
obj-$(CONFIG_DE620) += de620.o obj-$(CONFIG_DE620) += de620.o
obj-$(CONFIG_AT1500) += lance.o obj-$(CONFIG_AT1500) += lance.o
obj-$(CONFIG_LANCE) += lance.o obj-$(CONFIG_LANCE) += lance.o
obj-$(CONFIG_SUN3_82586) += sun3_82586.o
obj-$(CONFIG_SUN3LANCE) += sun3lance.o obj-$(CONFIG_SUN3LANCE) += sun3lance.o
obj-$(CONFIG_DEFXX) += defxx.o obj-$(CONFIG_DEFXX) += defxx.o
obj-$(CONFIG_SGISEEQ) += sgiseeq.o obj-$(CONFIG_SGISEEQ) += sgiseeq.o
......
This diff is collapsed.
...@@ -226,8 +226,8 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev) ...@@ -226,8 +226,8 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
AC_STOP_PG/4, dev->mem_start); AC_STOP_PG/4, dev->mem_start);
} }
dev->rmem_start = dev->mem_start + TX_PAGES*256; ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
dev->mem_end = dev->rmem_end = dev->mem_start dev->mem_end = ei_status.rmem_end = dev->mem_start
+ (AC_STOP_PG - AC_START_PG)*256; + (AC_STOP_PG - AC_START_PG)*256;
ei_status.name = "AC3200"; ei_status.name = "AC3200";
...@@ -302,12 +302,12 @@ static void ac_block_input(struct net_device *dev, int count, struct sk_buff *sk ...@@ -302,12 +302,12 @@ static void ac_block_input(struct net_device *dev, int count, struct sk_buff *sk
{ {
unsigned long xfer_start = dev->mem_start + ring_offset - (AC_START_PG<<8); unsigned long xfer_start = dev->mem_start + ring_offset - (AC_START_PG<<8);
if (xfer_start + count > dev->rmem_end) { if (xfer_start + count > ei_status.rmem_end) {
/* We must wrap the input move. */ /* We must wrap the input move. */
int semi_count = dev->rmem_end - xfer_start; int semi_count = ei_status.rmem_end - xfer_start;
isa_memcpy_fromio(skb->data, xfer_start, semi_count); isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count; count -= semi_count;
isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count); isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
} else { } else {
/* Packet is in one chunk -- we can copy + cksum. */ /* Packet is in one chunk -- we can copy + cksum. */
isa_eth_io_copy_and_sum(skb, xfer_start, count, 0); isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
......
...@@ -65,7 +65,10 @@ ...@@ -65,7 +65,10 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#endif
#ifdef SIOCETHTOOL #ifdef SIOCETHTOOL
#include <linux/ethtool.h> #include <linux/ethtool.h>
...@@ -320,9 +323,11 @@ static inline void tasklet_init(struct tasklet_struct *tasklet, ...@@ -320,9 +323,11 @@ static inline void tasklet_init(struct tasklet_struct *tasklet,
#if (defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)) && \ #if (defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)) && \
defined(NETIF_F_HW_VLAN_RX) defined(NETIF_F_HW_VLAN_RX)
#define ACENIC_DO_VLAN 1 #define ACENIC_DO_VLAN 1
#define ACE_RCB_VLAN_FLAG RCB_FLG_VLAN_ASSIST
#else #else
#define ACENIC_DO_VLAN 0 #define ACENIC_DO_VLAN 0
#define ACE_RCB_VLAN_FLAG 0
#endif #endif
#include "acenic.h" #include "acenic.h"
...@@ -563,7 +568,7 @@ static int tx_ratio[ACE_MAX_MOD_PARMS]; ...@@ -563,7 +568,7 @@ static int tx_ratio[ACE_MAX_MOD_PARMS];
static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1}; static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1};
static char version[] __initdata = static char version[] __initdata =
"acenic.c: v0.88 03/14/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" "acenic.c: v0.89 03/15/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n"
" http://home.cern.ch/~jes/gige/acenic.html\n"; " http://home.cern.ch/~jes/gige/acenic.html\n";
static struct net_device *root_dev; static struct net_device *root_dev;
...@@ -1461,10 +1466,8 @@ static int __init ace_init(struct net_device *dev) ...@@ -1461,10 +1466,8 @@ static int __init ace_init(struct net_device *dev)
set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma); set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma);
info->rx_std_ctrl.max_len = ACE_STD_MTU + ETH_HLEN + 4; info->rx_std_ctrl.max_len = ACE_STD_MTU + ETH_HLEN + 4;
info->rx_std_ctrl.flags = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; info->rx_std_ctrl.flags =
#if ACENIC_DO_VLAN RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
info->rx_std_ctrl.flags |= RCB_FLG_VLAN_ASSIST;
#endif
memset(ap->rx_std_ring, 0, memset(ap->rx_std_ring, 0,
RX_STD_RING_ENTRIES * sizeof(struct rx_desc)); RX_STD_RING_ENTRIES * sizeof(struct rx_desc));
...@@ -1479,10 +1482,8 @@ static int __init ace_init(struct net_device *dev) ...@@ -1479,10 +1482,8 @@ static int __init ace_init(struct net_device *dev)
(ap->rx_ring_base_dma + (ap->rx_ring_base_dma +
(sizeof(struct rx_desc) * RX_STD_RING_ENTRIES))); (sizeof(struct rx_desc) * RX_STD_RING_ENTRIES)));
info->rx_jumbo_ctrl.max_len = 0; info->rx_jumbo_ctrl.max_len = 0;
info->rx_jumbo_ctrl.flags = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; info->rx_jumbo_ctrl.flags =
#if ACENIC_DO_VLAN RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
info->rx_jumbo_ctrl.flags |= RCB_FLG_VLAN_ASSIST;
#endif
memset(ap->rx_jumbo_ring, 0, memset(ap->rx_jumbo_ring, 0,
RX_JUMBO_RING_ENTRIES * sizeof(struct rx_desc)); RX_JUMBO_RING_ENTRIES * sizeof(struct rx_desc));
...@@ -1504,10 +1505,7 @@ static int __init ace_init(struct net_device *dev) ...@@ -1504,10 +1505,7 @@ static int __init ace_init(struct net_device *dev)
RX_JUMBO_RING_ENTRIES)))); RX_JUMBO_RING_ENTRIES))));
info->rx_mini_ctrl.max_len = ACE_MINI_SIZE; info->rx_mini_ctrl.max_len = ACE_MINI_SIZE;
info->rx_mini_ctrl.flags = info->rx_mini_ctrl.flags =
RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|ACE_RCB_VLAN_FLAG;
#if ACENIC_DO_VLAN
info->rx_mini_ctrl.flags |= RCB_FLG_VLAN_ASSIST;
#endif
for (i = 0; i < RX_MINI_RING_ENTRIES; i++) for (i = 0; i < RX_MINI_RING_ENTRIES; i++)
ap->rx_mini_ring[i].flags = ap->rx_mini_ring[i].flags =
...@@ -1554,7 +1552,7 @@ static int __init ace_init(struct net_device *dev) ...@@ -1554,7 +1552,7 @@ static int __init ace_init(struct net_device *dev)
} }
info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap); info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap);
tmp = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; tmp = RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
/* /*
* The Tigon I does not like having the TX ring in host memory ;-( * The Tigon I does not like having the TX ring in host memory ;-(
...@@ -1563,9 +1561,6 @@ static int __init ace_init(struct net_device *dev) ...@@ -1563,9 +1561,6 @@ static int __init ace_init(struct net_device *dev)
tmp |= RCB_FLG_TX_HOST_RING; tmp |= RCB_FLG_TX_HOST_RING;
#if TX_COAL_INTS_ONLY #if TX_COAL_INTS_ONLY
tmp |= RCB_FLG_COAL_INT_ONLY; tmp |= RCB_FLG_COAL_INT_ONLY;
#endif
#if ACENIC_DO_VLAN
tmp |= RCB_FLG_VLAN_ASSIST;
#endif #endif
info->tx_ctrl.flags = tmp; info->tx_ctrl.flags = tmp;
...@@ -1592,7 +1587,7 @@ static int __init ace_init(struct net_device *dev) ...@@ -1592,7 +1587,7 @@ static int __init ace_init(struct net_device *dev)
ace_set_rxtx_parms(dev, 0); ace_set_rxtx_parms(dev, 0);
if (board_idx == BOARD_IDX_OVERFLOW) { if (board_idx == BOARD_IDX_OVERFLOW) {
printk(KERN_WARNING "%s: more then %i NICs detected, " printk(KERN_WARNING "%s: more than %i NICs detected, "
"ignoring module parameters!\n", "ignoring module parameters!\n",
dev->name, ACE_MAX_MOD_PARMS); dev->name, ACE_MAX_MOD_PARMS);
} else if (board_idx >= 0) { } else if (board_idx >= 0) {
...@@ -2181,14 +2176,6 @@ static u32 ace_handle_event(struct net_device *dev, u32 evtcsm, u32 evtprd) ...@@ -2181,14 +2176,6 @@ static u32 ace_handle_event(struct net_device *dev, u32 evtcsm, u32 evtprd)
} }
#if ACENIC_DO_VLAN
static int ace_vlan_rx(struct ace_private *ap, struct sk_buff *skb, u16 vlan_tag)
{
return vlan_hwaccel_rx(skb, ap->vlgrp, vlan_tag);
}
#endif
static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
{ {
struct ace_private *ap = dev->priv; struct ace_private *ap = dev->priv;
...@@ -2274,11 +2261,9 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) ...@@ -2274,11 +2261,9 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
} }
/* send it up */ /* send it up */
#if ACENIC_DO_VLAN #if ACENIC_DO_VLAN
if (ap->vlgrp != NULL && if (ap->vlgrp && (bd_flags & BD_FLG_VLAN_TAG)) {
(bd_flags & BD_FLG_VLAN_TAG)) { vlan_hwaccel_rx(skb, ap->vlgrp, retdesc->vlan);
ace_vlan_rx(ap, skb, retdesc->vlan);
} else } else
#endif #endif
netif_rx(skb); netif_rx(skb);
......
...@@ -642,10 +642,6 @@ struct ace_private ...@@ -642,10 +642,6 @@ struct ace_private
struct ace_skb *skb; struct ace_skb *skb;
dma_addr_t info_dma; /* 32/64 bit */ dma_addr_t info_dma; /* 32/64 bit */
#if ACENIC_DO_VLAN
struct vlan_group *vlgrp;
#endif
int version, link; int version, link;
int promisc, mcast_all; int promisc, mcast_all;
...@@ -655,7 +651,6 @@ struct ace_private ...@@ -655,7 +651,6 @@ struct ace_private
struct tx_desc *tx_ring; struct tx_desc *tx_ring;
u32 tx_prd; u32 tx_prd;
volatile u32 tx_ret_csm; volatile u32 tx_ret_csm;
struct timer_list timer;
int tx_ring_entries; int tx_ring_entries;
/* /*
...@@ -675,6 +670,10 @@ struct ace_private ...@@ -675,6 +670,10 @@ struct ace_private
struct rx_desc *rx_mini_ring; struct rx_desc *rx_mini_ring;
struct rx_desc *rx_return_ring; struct rx_desc *rx_return_ring;
#if ACENIC_DO_VLAN
struct vlan_group *vlgrp;
#endif
int tasklet_pending, jumbo; int tasklet_pending, jumbo;
struct tasklet_struct ace_tasklet; struct tasklet_struct ace_tasklet;
......
...@@ -450,7 +450,7 @@ struct awc_fid_queue { ...@@ -450,7 +450,7 @@ struct awc_fid_queue {
}; };
extern __inline__ void static __inline__ void
awc_fid_queue_init(struct awc_fid_queue * queue){ awc_fid_queue_init(struct awc_fid_queue * queue){
unsigned long flags; unsigned long flags;
...@@ -463,7 +463,7 @@ awc_fid_queue_init(struct awc_fid_queue * queue){ ...@@ -463,7 +463,7 @@ awc_fid_queue_init(struct awc_fid_queue * queue){
spin_unlock_irqrestore(&queue->spinlock,flags); spin_unlock_irqrestore(&queue->spinlock,flags);
}; };
extern inline void static inline void
awc_fid_queue_push_tail( struct awc_fid_queue * queue, awc_fid_queue_push_tail( struct awc_fid_queue * queue,
struct awc_fid * fid){ struct awc_fid * fid){
...@@ -488,7 +488,7 @@ awc_fid_queue_push_tail( struct awc_fid_queue * queue, ...@@ -488,7 +488,7 @@ awc_fid_queue_push_tail( struct awc_fid_queue * queue,
}; };
extern inline void static inline void
awc_fid_queue_push_head( struct awc_fid_queue * queue, awc_fid_queue_push_head( struct awc_fid_queue * queue,
struct awc_fid * fid){ struct awc_fid * fid){
...@@ -513,7 +513,7 @@ awc_fid_queue_push_head( struct awc_fid_queue * queue, ...@@ -513,7 +513,7 @@ awc_fid_queue_push_head( struct awc_fid_queue * queue,
extern inline void static inline void
awc_fid_queue_rm( struct awc_fid_queue * queue, awc_fid_queue_rm( struct awc_fid_queue * queue,
struct awc_fid * fid){ struct awc_fid * fid){
...@@ -541,7 +541,7 @@ awc_fid_queue_rm( struct awc_fid_queue * queue, ...@@ -541,7 +541,7 @@ awc_fid_queue_rm( struct awc_fid_queue * queue,
} }
}; };
extern inline void static inline void
awc_fid_queue_remove( struct awc_fid_queue * queue, awc_fid_queue_remove( struct awc_fid_queue * queue,
struct awc_fid * fid){ struct awc_fid * fid){
unsigned long flags; unsigned long flags;
...@@ -555,7 +555,7 @@ awc_fid_queue_remove( struct awc_fid_queue * queue, ...@@ -555,7 +555,7 @@ awc_fid_queue_remove( struct awc_fid_queue * queue,
extern inline struct awc_fid * static inline struct awc_fid *
awc_fid_queue_pop_head( struct awc_fid_queue * queue){ awc_fid_queue_pop_head( struct awc_fid_queue * queue){
unsigned long flags; unsigned long flags;
...@@ -575,7 +575,7 @@ awc_fid_queue_pop_head( struct awc_fid_queue * queue){ ...@@ -575,7 +575,7 @@ awc_fid_queue_pop_head( struct awc_fid_queue * queue){
extern inline struct awc_fid * static inline struct awc_fid *
awc_fid_queue_pop_tail( struct awc_fid_queue * queue){ awc_fid_queue_pop_tail( struct awc_fid_queue * queue){
unsigned long flags; unsigned long flags;
......
...@@ -153,8 +153,6 @@ static int __init arcrimi_found(struct net_device *dev) ...@@ -153,8 +153,6 @@ static int __init arcrimi_found(struct net_device *dev)
dev->mem_start = first_mirror; dev->mem_start = first_mirror;
dev->mem_end = last_mirror + MIRROR_SIZE - 1; dev->mem_end = last_mirror + MIRROR_SIZE - 1;
dev->rmem_start = dev->mem_start + BUFFER_SIZE * 0;
dev->rmem_end = dev->mem_start + BUFFER_SIZE * 2 - 1;
/* initialize the rest of the device structure. */ /* initialize the rest of the device structure. */
......
...@@ -447,8 +447,6 @@ static int __init com90xx_found(struct net_device *dev0, int ioaddr, int airq, ...@@ -447,8 +447,6 @@ static int __init com90xx_found(struct net_device *dev0, int ioaddr, int airq,
dev->mem_start = first_mirror; dev->mem_start = first_mirror;
dev->mem_end = last_mirror + MIRROR_SIZE - 1; dev->mem_end = last_mirror + MIRROR_SIZE - 1;
dev->rmem_start = dev->mem_start + BUFFER_SIZE * 0;
dev->rmem_end = dev->mem_start + BUFFER_SIZE * 2 - 1;
/* Initialize the rest of the device structure. */ /* Initialize the rest of the device structure. */
memset(lp, 0, sizeof(struct arcnet_local)); memset(lp, 0, sizeof(struct arcnet_local));
......
...@@ -128,7 +128,7 @@ int arlan_command(struct net_device * dev, int command); ...@@ -128,7 +128,7 @@ int arlan_command(struct net_device * dev, int command);
EXPORT_SYMBOL(arlan_command); EXPORT_SYMBOL(arlan_command);
extern inline long long arlan_time(void) static inline long long arlan_time(void)
{ {
struct timeval timev; struct timeval timev;
do_gettimeofday(&timev); do_gettimeofday(&timev);
...@@ -186,7 +186,7 @@ extern inline long long arlan_time(void) ...@@ -186,7 +186,7 @@ extern inline long long arlan_time(void)
extern inline int arlan_drop_tx(struct net_device *dev) static inline int arlan_drop_tx(struct net_device *dev)
{ {
struct arlan_private *priv = ((struct arlan_private *) dev->priv); struct arlan_private *priv = ((struct arlan_private *) dev->priv);
...@@ -554,7 +554,7 @@ int arlan_command(struct net_device *dev, int command_p) ...@@ -554,7 +554,7 @@ int arlan_command(struct net_device *dev, int command_p)
}; };
extern inline void arlan_command_process(struct net_device *dev) static inline void arlan_command_process(struct net_device *dev)
{ {
struct arlan_private *priv = ((struct arlan_private *) dev->priv); struct arlan_private *priv = ((struct arlan_private *) dev->priv);
...@@ -575,7 +575,7 @@ extern inline void arlan_command_process(struct net_device *dev) ...@@ -575,7 +575,7 @@ extern inline void arlan_command_process(struct net_device *dev)
} }
extern inline void arlan_retransmit_now(struct net_device *dev) static inline void arlan_retransmit_now(struct net_device *dev)
{ {
struct arlan_private *priv = ((struct arlan_private *) dev->priv); struct arlan_private *priv = ((struct arlan_private *) dev->priv);
...@@ -1405,7 +1405,7 @@ static int arlan_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -1405,7 +1405,7 @@ static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
} }
extern inline int DoNotReTransmitCrap(struct net_device *dev) static inline int DoNotReTransmitCrap(struct net_device *dev)
{ {
struct arlan_private *priv = ((struct arlan_private *) dev->priv); struct arlan_private *priv = ((struct arlan_private *) dev->priv);
...@@ -1415,7 +1415,7 @@ extern inline int DoNotReTransmitCrap(struct net_device *dev) ...@@ -1415,7 +1415,7 @@ extern inline int DoNotReTransmitCrap(struct net_device *dev)
} }
extern inline int DoNotWaitReTransmitCrap(struct net_device *dev) static inline int DoNotWaitReTransmitCrap(struct net_device *dev)
{ {
struct arlan_private *priv = ((struct arlan_private *) dev->priv); struct arlan_private *priv = ((struct arlan_private *) dev->priv);
...@@ -1424,7 +1424,7 @@ extern inline int DoNotWaitReTransmitCrap(struct net_device *dev) ...@@ -1424,7 +1424,7 @@ extern inline int DoNotWaitReTransmitCrap(struct net_device *dev)
return 0; return 0;
} }
extern inline void arlan_queue_retransmit(struct net_device *dev) static inline void arlan_queue_retransmit(struct net_device *dev)
{ {
struct arlan_private *priv = ((struct arlan_private *) dev->priv); struct arlan_private *priv = ((struct arlan_private *) dev->priv);
......
...@@ -465,7 +465,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) ...@@ -465,7 +465,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr)
#define EE_DATA_READ 0x80 /* EEPROM chip data out, in reg. 17. */ #define EE_DATA_READ 0x80 /* EEPROM chip data out, in reg. 17. */
/* Delay between EEPROM clock transitions. */ /* Delay between EEPROM clock transitions. */
#define eeprom_delay() do {} while (0); #define eeprom_delay() do { } while (0)
/* The EEPROM commands include the alway-set leading bit. */ /* The EEPROM commands include the alway-set leading bit. */
#define EE_WRITE_CMD (5 << 6) #define EE_WRITE_CMD (5 << 6)
......
...@@ -667,7 +667,7 @@ static void atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs) ...@@ -667,7 +667,7 @@ static void atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs)
} }
num_tx_since_rx++; num_tx_since_rx++;
} else if (num_tx_since_rx > 8 } else if (num_tx_since_rx > 8
&& jiffies > dev->last_rx + HZ) { && time_after(jiffies, dev->last_rx + HZ)) {
if (net_debug > 2) if (net_debug > 2)
printk(KERN_DEBUG "%s: Missed packet? No Rx after %d Tx and " printk(KERN_DEBUG "%s: Missed packet? No Rx after %d Tx and "
"%ld jiffies status %02x CMR1 %02x.\n", dev->name, "%ld jiffies status %02x CMR1 %02x.\n", dev->name,
......
...@@ -513,14 +513,14 @@ static int __init ns8390_probe1(struct net_device *dev, int word16, char *model_ ...@@ -513,14 +513,14 @@ static int __init ns8390_probe1(struct net_device *dev, int word16, char *model_
ei_status.tx_start_page = CABLETRON_TX_START_PG; ei_status.tx_start_page = CABLETRON_TX_START_PG;
ei_status.rx_start_page = CABLETRON_RX_START_PG; ei_status.rx_start_page = CABLETRON_RX_START_PG;
ei_status.stop_page = CABLETRON_RX_STOP_PG; ei_status.stop_page = CABLETRON_RX_STOP_PG;
dev->rmem_start = dev->mem_start; ei_status.rmem_start = dev->mem_start;
dev->rmem_end = dev->mem_start + CABLETRON_RX_STOP_PG*256; ei_status.rmem_end = dev->mem_start + CABLETRON_RX_STOP_PG*256;
} else { } else {
ei_status.tx_start_page = WD_START_PG; ei_status.tx_start_page = WD_START_PG;
ei_status.rx_start_page = WD_START_PG + TX_PAGES; ei_status.rx_start_page = WD_START_PG + TX_PAGES;
ei_status.stop_page = (dev->mem_end - dev->mem_start)/256; ei_status.stop_page = (dev->mem_end - dev->mem_start)/256;
dev->rmem_start = dev->mem_start + TX_PAGES*256; ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
dev->rmem_end = dev->mem_end; ei_status.rmem_end = dev->mem_end;
} }
if(promoff==-1) /* Use nubus resources ? */ if(promoff==-1) /* Use nubus resources ? */
...@@ -779,14 +779,14 @@ static void dayna_block_input(struct net_device *dev, int count, struct sk_buff ...@@ -779,14 +779,14 @@ static void dayna_block_input(struct net_device *dev, int count, struct sk_buff
* is word per long onto our space. * is word per long onto our space.
*/ */
if (xfer_start + count > dev->rmem_end) if (xfer_start + count > ei_status.rmem_end)
{ {
/* We must wrap the input move. */ /* We must wrap the input move. */
int semi_count = dev->rmem_end - xfer_start; int semi_count = ei_status.rmem_end - xfer_start;
dayna_memcpy_fromcard(dev, skb->data, xfer_base, semi_count); dayna_memcpy_fromcard(dev, skb->data, xfer_base, semi_count);
count -= semi_count; count -= semi_count;
dayna_memcpy_fromcard(dev, skb->data + semi_count, dayna_memcpy_fromcard(dev, skb->data + semi_count,
dev->rmem_start - dev->mem_start, count); ei_status.rmem_start - dev->mem_start, count);
} }
else else
{ {
...@@ -820,14 +820,14 @@ static void sane_block_input(struct net_device *dev, int count, struct sk_buff * ...@@ -820,14 +820,14 @@ static void sane_block_input(struct net_device *dev, int count, struct sk_buff *
unsigned long xfer_base = ring_offset - (WD_START_PG<<8); unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
unsigned long xfer_start = xfer_base+dev->mem_start; unsigned long xfer_start = xfer_base+dev->mem_start;
if (xfer_start + count > dev->rmem_end) if (xfer_start + count > ei_status.rmem_end)
{ {
/* We must wrap the input move. */ /* We must wrap the input move. */
int semi_count = dev->rmem_end - xfer_start; int semi_count = ei_status.rmem_end - xfer_start;
memcpy(skb->data, (char *)dev->mem_start+xfer_base, semi_count); memcpy(skb->data, (char *)dev->mem_start+xfer_base, semi_count);
count -= semi_count; count -= semi_count;
memcpy(skb->data + semi_count, memcpy(skb->data + semi_count,
(char *)dev->rmem_start, count); (char *)ei_status.rmem_start, count);
} }
else else
{ {
...@@ -881,14 +881,14 @@ static void slow_sane_block_input(struct net_device *dev, int count, struct sk_b ...@@ -881,14 +881,14 @@ static void slow_sane_block_input(struct net_device *dev, int count, struct sk_b
unsigned long xfer_base = ring_offset - (WD_START_PG<<8); unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
unsigned long xfer_start = xfer_base+dev->mem_start; unsigned long xfer_start = xfer_base+dev->mem_start;
if (xfer_start + count > dev->rmem_end) if (xfer_start + count > ei_status.rmem_end)
{ {
/* We must wrap the input move. */ /* We must wrap the input move. */
int semi_count = dev->rmem_end - xfer_start; int semi_count = ei_status.rmem_end - xfer_start;
word_memcpy_fromcard(skb->data, (char *)dev->mem_start+xfer_base, semi_count); word_memcpy_fromcard(skb->data, (char *)dev->mem_start+xfer_base, semi_count);
count -= semi_count; count -= semi_count;
word_memcpy_fromcard(skb->data + semi_count, word_memcpy_fromcard(skb->data + semi_count,
(char *)dev->rmem_start, count); (char *)ei_status.rmem_start, count);
} }
else else
{ {
......
...@@ -449,11 +449,17 @@ static int de620_open(struct net_device *dev) ...@@ -449,11 +449,17 @@ static int de620_open(struct net_device *dev)
return ret; return ret;
} }
if (adapter_init(dev)) if (adapter_init(dev)) {
return -EIO; ret = -EIO;
goto out_free_irq;
}
netif_start_queue(dev); netif_start_queue(dev);
return 0; return 0;
out_free_irq:
free_irq(dev->irq, dev);
return ret;
} }
/************************************************ /************************************************
...@@ -850,7 +856,10 @@ int __init de620_probe(struct net_device *dev) ...@@ -850,7 +856,10 @@ int __init de620_probe(struct net_device *dev)
return -EBUSY; return -EBUSY;
} }
#endif #endif
request_region(dev->base_addr, 3, "de620"); if (!request_region(dev->base_addr, 3, "de620")) {
printk(KERN_ERR "io 0x%3lX, which is busy.\n", dev->base_addr);
return -EBUSY;
}
/* else, got it! */ /* else, got it! */
printk(", Ethernet Address: %2.2X", printk(", Ethernet Address: %2.2X",
......
/* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */ /* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */
/* /*
Copyright (c) 2001 by D-Link Corporation Copyright (c) 2001,2002 by D-Link Corporation
Written by Edward Peng.<edward_peng@dlink.com.tw> Written by Edward Peng.<edward_peng@dlink.com.tw>
Created 03-May-2001, base on Linux' sundance.c. Created 03-May-2001, base on Linux' sundance.c.
...@@ -27,12 +27,14 @@ ...@@ -27,12 +27,14 @@
Added tx_coalesce paramter. Added tx_coalesce paramter.
1.07 2002/01/03 Fixed miscount of RX frame error. 1.07 2002/01/03 Fixed miscount of RX frame error.
1.08 2002/01/17 Fixed the multicast bug. 1.08 2002/01/17 Fixed the multicast bug.
1.09 2002/03/07 Move rx-poll-now to re-fill loop.
Added rio_timer() to watch rx buffers.
*/ */
#include "dl2k.h" #include "dl2k.h"
static char version[] __devinitdata = static char version[] __devinitdata =
KERN_INFO "D-Link DL2000-based linux driver v1.08 2002/01/17\n"; KERN_INFO "D-Link DL2000-based linux driver v1.09 2002/03/07\n";
#define MAX_UNITS 8 #define MAX_UNITS 8
static int mtu[MAX_UNITS]; static int mtu[MAX_UNITS];
...@@ -42,9 +44,10 @@ static char *media[MAX_UNITS]; ...@@ -42,9 +44,10 @@ static char *media[MAX_UNITS];
static int tx_flow[MAX_UNITS]; static int tx_flow[MAX_UNITS];
static int rx_flow[MAX_UNITS]; static int rx_flow[MAX_UNITS];
static int copy_thresh; static int copy_thresh;
static int rx_coalesce = DEFAULT_RXC; static int rx_coalesce; /* Rx frame count each interrupt */
static int rx_timeout = DEFAULT_RXT; static int rx_timeout; /* Rx DMA wait time in 64ns increments */
static int tx_coalesce = DEFAULT_TXC; static int tx_coalesce = DEFAULT_TXC; /* HW xmit count each TxComplete [1-8] */
MODULE_AUTHOR ("Edward Peng"); MODULE_AUTHOR ("Edward Peng");
MODULE_DESCRIPTION ("D-Link DL2000-based Gigabit Ethernet Adapter"); MODULE_DESCRIPTION ("D-Link DL2000-based Gigabit Ethernet Adapter");
...@@ -71,6 +74,7 @@ static int max_intrloop = 50; ...@@ -71,6 +74,7 @@ static int max_intrloop = 50;
static int multicast_filter_limit = 0x40; static int multicast_filter_limit = 0x40;
static int rio_open (struct net_device *dev); static int rio_open (struct net_device *dev);
static void rio_timer (unsigned long data);
static void tx_timeout (struct net_device *dev); static void tx_timeout (struct net_device *dev);
static void alloc_list (struct net_device *dev); static void alloc_list (struct net_device *dev);
static int start_xmit (struct sk_buff *skb, struct net_device *dev); static int start_xmit (struct sk_buff *skb, struct net_device *dev);
...@@ -146,6 +150,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -146,6 +150,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
np->chip_id = chip_idx; np->chip_id = chip_idx;
np->pdev = pdev; np->pdev = pdev;
spin_lock_init (&np->lock); spin_lock_init (&np->lock);
spin_lock_init (&np->rx_lock);
/* Parse manual configuration */ /* Parse manual configuration */
np->an_enable = 1; np->an_enable = 1;
...@@ -260,6 +265,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -260,6 +265,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
np->an_enable = 1; np->an_enable = 1;
mii_set_media (dev); mii_set_media (dev);
} }
pci_read_config_byte(pdev, PCI_REVISION_ID, &np->pci_rev_id);
/* Reset all logic functions */ /* Reset all logic functions */
writew (GlobalReset | DMAReset | FIFOReset | NetworkReset | HostReset, writew (GlobalReset | DMAReset | FIFOReset | NetworkReset | HostReset,
...@@ -340,7 +346,7 @@ parse_eeprom (struct net_device *dev) ...@@ -340,7 +346,7 @@ parse_eeprom (struct net_device *dev)
} }
/* Check CRC */ /* Check CRC */
crc = ~ether_crc_le(256 - 4, sromdata); crc = ~ether_crc_le(256 - 4, sromdata);
if (psrom->crc != crc) { if (psrom->crc != crc) {
printk (KERN_ERR "%s: EEPROM data CRC error.\n", dev->name); printk (KERN_ERR "%s: EEPROM data CRC error.\n", dev->name);
return -1; return -1;
...@@ -421,8 +427,10 @@ rio_open (struct net_device *dev) ...@@ -421,8 +427,10 @@ rio_open (struct net_device *dev)
ioaddr + RxDMAIntCtrl); ioaddr + RxDMAIntCtrl);
} }
/* Set RIO to poll every N*320nsec. */ /* Set RIO to poll every N*320nsec. */
writeb (0xff, ioaddr + RxDMAPollPeriod); writeb (0x20, ioaddr + RxDMAPollPeriod);
writeb (0xff, ioaddr + TxDMAPollPeriod); writeb (0xff, ioaddr + TxDMAPollPeriod);
writeb (0x30, ioaddr + RxDMABurstThresh);
writeb (0x30, ioaddr + RxDMAUrgentThresh);
netif_start_queue (dev); netif_start_queue (dev);
writel (StatsEnable | RxEnable | TxEnable, ioaddr + MACCtrl); writel (StatsEnable | RxEnable | TxEnable, ioaddr + MACCtrl);
/* VLAN supported */ /* VLAN supported */
...@@ -445,9 +453,59 @@ rio_open (struct net_device *dev) ...@@ -445,9 +453,59 @@ rio_open (struct net_device *dev)
/* clear statistics */ /* clear statistics */
get_stats (dev); get_stats (dev);
init_timer (&np->timer);
np->timer.expires = jiffies + 1*HZ;
np->timer.data = (unsigned long) dev;
np->timer.function = &rio_timer;
add_timer (&np->timer);
return 0; return 0;
} }
static void
rio_timer (unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
unsigned int entry;
int next_tick = 1*HZ;
unsigned long flags;
/* Recover rx ring exhausted error */
if (np->cur_rx - np->old_rx >= RX_RING_SIZE) {
printk(KERN_INFO "Try to recover rx ring exhausted...\n");
spin_lock_irqsave(&np->rx_lock, flags);
/* Re-allocate skbuffs to fill the descriptor ring */
for (; np->cur_rx - np->old_rx > 0; np->old_rx++) {
struct sk_buff *skb;
entry = np->old_rx % RX_RING_SIZE;
/* Dropped packets don't need to re-allocate */
if (np->rx_skbuff[entry] == NULL) {
skb = dev_alloc_skb (np->rx_buf_sz);
if (skb == NULL) {
np->rx_ring[entry].fraginfo = 0;
printk (KERN_INFO
"%s: Still unable to re-allocate Rx skbuff.#%d\n",
dev->name, entry);
break;
}
np->rx_skbuff[entry] = skb;
skb->dev = dev;
/* 16 byte align the IP header */
skb_reserve (skb, 2);
np->rx_ring[entry].fraginfo =
cpu_to_le64 (pci_map_single
(np->pdev, skb->tail, np->rx_buf_sz,
PCI_DMA_FROMDEVICE));
}
np->rx_ring[entry].fraginfo |=
cpu_to_le64 (np->rx_buf_sz) << 48;
np->rx_ring[entry].status = 0;
} /* end for */
spin_unlock_irqrestore (&np->rx_lock, flags);
} /* end if */
np->timer.expires = jiffies + next_tick;
add_timer(&np->timer);
}
static void static void
tx_timeout (struct net_device *dev) tx_timeout (struct net_device *dev)
{ {
...@@ -499,16 +557,14 @@ alloc_list (struct net_device *dev) ...@@ -499,16 +557,14 @@ alloc_list (struct net_device *dev)
np->tx_ring[i].status = cpu_to_le64 (TFDDone); np->tx_ring[i].status = cpu_to_le64 (TFDDone);
np->tx_ring[i].next_desc = cpu_to_le64 (np->tx_ring_dma + np->tx_ring[i].next_desc = cpu_to_le64 (np->tx_ring_dma +
((i+1)%TX_RING_SIZE) * ((i+1)%TX_RING_SIZE) *
sizeof (struct sizeof (struct netdev_desc));
netdev_desc));
} }
/* Initialize Rx descriptors */ /* Initialize Rx descriptors */
for (i = 0; i < RX_RING_SIZE; i++) { for (i = 0; i < RX_RING_SIZE; i++) {
np->rx_ring[i].next_desc = cpu_to_le64 (np->rx_ring_dma + np->rx_ring[i].next_desc = cpu_to_le64 (np->rx_ring_dma +
((i + 1) % RX_RING_SIZE) * ((i + 1) % RX_RING_SIZE) *
sizeof (struct sizeof (struct netdev_desc));
netdev_desc));
np->rx_ring[i].status = 0; np->rx_ring[i].status = 0;
np->rx_ring[i].fraginfo = 0; np->rx_ring[i].fraginfo = 0;
np->rx_skbuff[i] = 0; np->rx_skbuff[i] = 0;
...@@ -529,8 +585,8 @@ alloc_list (struct net_device *dev) ...@@ -529,8 +585,8 @@ alloc_list (struct net_device *dev)
skb_reserve (skb, 2); /* 16 byte align the IP header. */ skb_reserve (skb, 2); /* 16 byte align the IP header. */
/* Rubicon now supports 40 bits of addressing space. */ /* Rubicon now supports 40 bits of addressing space. */
np->rx_ring[i].fraginfo = np->rx_ring[i].fraginfo =
cpu_to_le64 (pci_map_single cpu_to_le64 ( pci_map_single (
(np->pdev, skb->tail, np->rx_buf_sz, np->pdev, skb->tail, np->rx_buf_sz,
PCI_DMA_FROMDEVICE)); PCI_DMA_FROMDEVICE));
np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48;
} }
...@@ -773,6 +829,8 @@ receive_packet (struct net_device *dev) ...@@ -773,6 +829,8 @@ receive_packet (struct net_device *dev)
int entry = np->cur_rx % RX_RING_SIZE; int entry = np->cur_rx % RX_RING_SIZE;
int cnt = np->old_rx + RX_RING_SIZE - np->cur_rx; int cnt = np->old_rx + RX_RING_SIZE - np->cur_rx;
int rx_shift; int rx_shift;
spin_lock (&np->rx_lock);
if (np->old_rx > RX_RING_SIZE) { if (np->old_rx > RX_RING_SIZE) {
rx_shift = RX_RING_SIZE; rx_shift = RX_RING_SIZE;
np->old_rx -= rx_shift; np->old_rx -= rx_shift;
...@@ -828,12 +886,14 @@ receive_packet (struct net_device *dev) ...@@ -828,12 +886,14 @@ receive_packet (struct net_device *dev)
skb_put (skb, pkt_len); skb_put (skb, pkt_len);
} }
skb->protocol = eth_type_trans (skb, dev); skb->protocol = eth_type_trans (skb, dev);
#if 0 #if 0
/* Checksum done by hw, but csum value unavailable. */ /* Checksum done by hw, but csum value unavailable. */
if (!(frame_status & (TCPError | UDPError | IPError))) { if (np->pci_rev_id >= 0x0c &&
!(frame_status & (TCPError | UDPError | IPError))) {
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
#endif #endif
netif_rx (skb); netif_rx (skb);
dev->last_rx = jiffies; dev->last_rx = jiffies;
} }
...@@ -849,9 +909,10 @@ receive_packet (struct net_device *dev) ...@@ -849,9 +909,10 @@ receive_packet (struct net_device *dev)
skb = dev_alloc_skb (np->rx_buf_sz); skb = dev_alloc_skb (np->rx_buf_sz);
if (skb == NULL) { if (skb == NULL) {
np->rx_ring[entry].fraginfo = 0; np->rx_ring[entry].fraginfo = 0;
printk (KERN_ERR printk (KERN_INFO
"%s: Allocate Rx buffer error!", "%s: receive_packet: "
dev->name); "Unable to re-allocate Rx skbuff.#%d\n",
dev->name, entry);
break; break;
} }
np->rx_skbuff[entry] = skb; np->rx_skbuff[entry] = skb;
...@@ -866,13 +927,12 @@ receive_packet (struct net_device *dev) ...@@ -866,13 +927,12 @@ receive_packet (struct net_device *dev)
np->rx_ring[entry].fraginfo |= np->rx_ring[entry].fraginfo |=
cpu_to_le64 (np->rx_buf_sz) << 48; cpu_to_le64 (np->rx_buf_sz) << 48;
np->rx_ring[entry].status = 0; np->rx_ring[entry].status = 0;
/* RxDMAPollNow */
writel (readl (dev->base_addr + DMACtrl) | 0x00000010,
dev->base_addr + DMACtrl);
} }
/* RxDMAPollNow */
writel (readl (dev->base_addr + DMACtrl) | 0x00000010,
dev->base_addr + DMACtrl);
DEBUG_RFD_DUMP (np, 2); DEBUG_RFD_DUMP (np, 2);
spin_unlock(&np->rx_lock);
return 0; return 0;
} }
...@@ -1006,7 +1066,7 @@ set_multicast (struct net_device *dev) ...@@ -1006,7 +1066,7 @@ set_multicast (struct net_device *dev)
hash_table[0] = hash_table[1] = 0; hash_table[0] = hash_table[1] = 0;
/* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
hash_table[1] |= 0x02000000; hash_table[1] |= cpu_to_le32(0x02000000);
if (dev->flags & IFF_PROMISC) { if (dev->flags & IFF_PROMISC) {
/* Receive all frames promiscuously. */ /* Receive all frames promiscuously. */
rx_mode = ReceiveAllFrames; rx_mode = ReceiveAllFrames;
...@@ -1020,11 +1080,16 @@ set_multicast (struct net_device *dev) ...@@ -1020,11 +1080,16 @@ set_multicast (struct net_device *dev)
rx_mode = rx_mode =
ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast; ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast;
for (i=0, mclist = dev->mc_list; mclist && i < dev->mc_count; for (i=0, mclist = dev->mc_list; mclist && i < dev->mc_count;
i++, mclist=mclist->next) { i++, mclist=mclist->next) {
crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr); crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr);
for (index=0, bit=0; bit<6; bit++, crc<<=1) {
if (crc & 0x80000000) index |= 1 << bit; /* The inverted high significant 6 bits of CRC are
} used as an index to hashtable */
for (index = 0, bit = 0; bit < 6; bit++)
if (test_bit(31 - bit, &crc))
set_bit(bit, &index);
hash_table[index / 32] |= (1 << (index % 32)); hash_table[index / 32] |= (1 << (index % 32));
} }
} else { } else {
...@@ -1094,6 +1159,7 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1094,6 +1159,7 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
np->old_rx); np->old_rx);
break; break;
case SIOCDEVPRIVATE + 8: case SIOCDEVPRIVATE + 8:
printk("TX ring:\n");
for (i = 0; i < TX_RING_SIZE; i++) { for (i = 0; i < TX_RING_SIZE; i++) {
desc = &np->tx_ring[i]; desc = &np->tx_ring[i];
printk printk
...@@ -1629,7 +1695,8 @@ rio_close (struct net_device *dev) ...@@ -1629,7 +1695,8 @@ rio_close (struct net_device *dev)
writel (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl); writel (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl);
synchronize_irq (); synchronize_irq ();
free_irq (dev->irq, dev); free_irq (dev->irq, dev);
del_timer_sync (&np->timer);
/* Free all the skbuffs in the queue. */ /* Free all the skbuffs in the queue. */
for (i = 0; i < RX_RING_SIZE; i++) { for (i = 0; i < RX_RING_SIZE; i++) {
np->rx_ring[i].status = 0; np->rx_ring[i].status = 0;
...@@ -1679,10 +1746,10 @@ rio_remove1 (struct pci_dev *pdev) ...@@ -1679,10 +1746,10 @@ rio_remove1 (struct pci_dev *pdev)
} }
static struct pci_driver rio_driver = { static struct pci_driver rio_driver = {
name:"dl2k", name: "dl2k",
id_table:rio_pci_tbl, id_table: rio_pci_tbl,
probe:rio_probe1, probe: rio_probe1,
remove: __devexit_p(rio_remove1), remove: __devexit_p(rio_remove1),
}; };
static int __init static int __init
......
/* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */ /* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */
/* /*
Copyright (c) 2001 by D-Link Corporation Copyright (c) 2001, 2002 by D-Link Corporation
Written by Edward Peng.<edward_peng@dlink.com.tw> Written by Edward Peng.<edward_peng@dlink.com.tw>
Created 03-May-2001, base on Linux' sundance.c. Created 03-May-2001, base on Linux' sundance.c.
...@@ -649,6 +649,7 @@ struct netdev_private { ...@@ -649,6 +649,7 @@ struct netdev_private {
dma_addr_t rx_ring_dma; dma_addr_t rx_ring_dma;
struct pci_dev *pdev; struct pci_dev *pdev;
spinlock_t lock; spinlock_t lock;
spinlock_t rx_lock;
struct net_device_stats stats; struct net_device_stats stats;
unsigned int rx_buf_sz; /* Based on MTU+slack. */ unsigned int rx_buf_sz; /* Based on MTU+slack. */
unsigned int speed; /* Operating speed */ unsigned int speed; /* Operating speed */
...@@ -664,9 +665,11 @@ struct netdev_private { ...@@ -664,9 +665,11 @@ struct netdev_private {
unsigned int tx_flow:1; /* Tx flow control enable */ unsigned int tx_flow:1; /* Tx flow control enable */
unsigned int rx_flow:1; /* Rx flow control enable */ unsigned int rx_flow:1; /* Rx flow control enable */
unsigned int phy_media:1; /* 1: fiber, 0: copper */ unsigned int phy_media:1; /* 1: fiber, 0: copper */
unsigned char pci_rev_id; /* PCI revision ID */
struct netdev_desc *last_tx; /* Last Tx descriptor used. */ struct netdev_desc *last_tx; /* Last Tx descriptor used. */
unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */ unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */
unsigned long cur_tx, old_tx; unsigned long cur_tx, old_tx;
struct timer_list timer;
int wake_polarity; int wake_polarity;
char name[256]; /* net device description */ char name[256]; /* net device description */
u8 duplex_polarity; u8 duplex_polarity;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
O_TARGET := e100.o O_TARGET := e100.o
obj-y := e100_main.o e100_config.o e100_proc.o e100_phy.o \ obj-y := e100_main.o e100_config.o e100_proc.o e100_phy.o \
e100_eeprom.o e100_eeprom.o e100_test.o
obj-m := $(O_TARGET) obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -899,6 +899,15 @@ struct cfg_params { ...@@ -899,6 +899,15 @@ struct cfg_params {
int PollingMaxWork; int PollingMaxWork;
u32 b_params; u32 b_params;
}; };
#ifdef ETHTOOL_TEST
struct ethtool_lpbk_data{
dma_addr_t dma_handle;
tcb_t *tcb;
rfd_t *rfd;
};
#endif
struct e100_private { struct e100_private {
u32 flags; /* board management flags */ u32 flags; /* board management flags */
...@@ -988,6 +997,9 @@ struct e100_private { ...@@ -988,6 +997,9 @@ struct e100_private {
u32 wolopts; u32 wolopts;
u16 ip_lbytes; u16 ip_lbytes;
#endif #endif
#ifdef ETHTOOL_TEST
struct ethtool_lpbk_data loopback;
#endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
u32 pci_state[16]; u32 pci_state[16];
...@@ -1028,4 +1040,23 @@ extern void e100_deisolate_driver(struct e100_private *bdp, ...@@ -1028,4 +1040,23 @@ extern void e100_deisolate_driver(struct e100_private *bdp,
extern unsigned char e100_hw_reset_recover(struct e100_private *bdp, extern unsigned char e100_hw_reset_recover(struct e100_private *bdp,
u32 reset_cmd); u32 reset_cmd);
#ifdef ETHTOOL_TEST
#define ROM_TEST_FAIL 0x01
#define REGISTER_TEST_FAIL 0x02
#define SELF_TEST_FAIL 0x04
#define TEST_TIMEOUT 0x08
enum test_offsets {
E100_EEPROM_TEST_FAIL = 0,
E100_CHIP_TIMEOUT,
E100_ROM_TEST_FAIL,
E100_REG_TEST_FAIL,
E100_MAC_TEST_FAIL,
E100_LPBK_MAC_FAIL,
E100_LPBK_PHY_FAIL,
E100_MAX_TEST_RES
};
#endif
#endif #endif
...@@ -593,3 +593,102 @@ e100_config_wol(struct e100_private *bdp) ...@@ -593,3 +593,102 @@ e100_config_wol(struct e100_private *bdp)
} }
#endif #endif
#ifdef ETHTOOL_TEST
/**
* e100_config_loopback_mode
* @bdp: atapter's private data struct
* @mode: loopback mode(phy/mac/none)
*
*/
unsigned char
e100_config_loopback_mode(struct e100_private *bdp, u8 mode)
{
unsigned char bc_changed = false;
u8 config_byte;
spin_lock_bh(&(bdp->config_lock));
switch (mode) {
case NO_LOOPBACK:
config_byte = CB_CFIG_LOOPBACK_NORMAL;
break;
case MAC_LOOPBACK:
config_byte = CB_CFIG_LOOPBACK_INTERNAL;
break;
case PHY_LOOPBACK:
config_byte = CB_CFIG_LOOPBACK_EXTERNAL;
break;
default:
printk(KERN_NOTICE "e100_config_loopback_mode: "
"Invalid argument 'mode': %d\n", mode);
goto exit;
}
if ((bdp->config[10] & CB_CFIG_LOOPBACK_MODE) != config_byte) {
bdp->config[10] &= (~CB_CFIG_LOOPBACK_MODE);
bdp->config[10] |= config_byte;
E100_CONFIG(bdp, 10);
bc_changed = true;
}
exit:
spin_unlock_bh(&(bdp->config_lock));
return bc_changed;
}
unsigned char
e100_config_tcb_ext_enable(struct e100_private *bdp, unsigned char enable)
{
unsigned char bc_changed = false;
spin_lock_bh(&(bdp->config_lock));
if (enable) {
if (bdp->config[6] & CB_CFIG_EXT_TCB_DIS) {
bdp->config[6] &= (~CB_CFIG_EXT_TCB_DIS);
E100_CONFIG(bdp, 6);
bc_changed = true;
}
} else {
if (!(bdp->config[6] & CB_CFIG_EXT_TCB_DIS)) {
bdp->config[6] |= CB_CFIG_EXT_TCB_DIS;
E100_CONFIG(bdp, 6);
bc_changed = true;
}
}
spin_unlock_bh(&(bdp->config_lock));
return bc_changed;
}
unsigned char
e100_config_dynamic_tbd(struct e100_private *bdp, unsigned char enable)
{
unsigned char bc_changed = false;
spin_lock_bh(&(bdp->config_lock));
if (enable) {
if (!(bdp->config[7] & CB_CFIG_DYNTBD_EN)) {
bdp->config[7] |= CB_CFIG_DYNTBD_EN;
E100_CONFIG(bdp, 7);
bc_changed = true;
}
} else {
if (bdp->config[7] & CB_CFIG_DYNTBD_EN) {
bdp->config[7] &= (~CB_CFIG_DYNTBD_EN);
E100_CONFIG(bdp, 7);
bc_changed = true;
}
}
spin_unlock_bh(&(bdp->config_lock));
return bc_changed;
}
#endif
...@@ -190,6 +190,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -190,6 +190,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define CB_CFIG_LONG_RX_OK BIT_3 #define CB_CFIG_LONG_RX_OK BIT_3
#define NO_LOOPBACK 0
#define MAC_LOOPBACK 0x01
#define PHY_LOOPBACK 0x02
/* function prototypes */ /* function prototypes */
extern void e100_config_init(struct e100_private *bdp); extern void e100_config_init(struct e100_private *bdp);
extern unsigned char e100_force_config(struct e100_private *bdp); extern unsigned char e100_force_config(struct e100_private *bdp);
...@@ -201,5 +205,8 @@ extern void e100_config_mulcast_enbl(struct e100_private *bdp, ...@@ -201,5 +205,8 @@ extern void e100_config_mulcast_enbl(struct e100_private *bdp,
unsigned char enable); unsigned char enable);
extern void e100_config_ifs(struct e100_private *bdp); extern void e100_config_ifs(struct e100_private *bdp);
extern void e100_config_force_dplx(struct e100_private *bdp); extern void e100_config_force_dplx(struct e100_private *bdp);
extern u8 e100_config_loopback_mode(struct e100_private *bdp, u8 mode);
extern u8 e100_config_dynamic_tbd(struct e100_private *bdp, u8 enable);
extern u8 e100_config_tcb_ext_enable(struct e100_private *bdp, u8 enable);
#endif /* _E100_CONFIG_INC_ */ #endif /* _E100_CONFIG_INC_ */
...@@ -146,6 +146,23 @@ static unsigned char e100_setup_filter(struct e100_private *bdp); ...@@ -146,6 +146,23 @@ static unsigned char e100_setup_filter(struct e100_private *bdp);
static void e100_do_wol(struct pci_dev *pcid, struct e100_private *bdp); static void e100_do_wol(struct pci_dev *pcid, struct e100_private *bdp);
static u16 e100_get_ip_lbytes(struct net_device *dev); static u16 e100_get_ip_lbytes(struct net_device *dev);
extern void e100_config_wol(struct e100_private *bdp); extern void e100_config_wol(struct e100_private *bdp);
#endif
#ifdef ETHTOOL_TEST
extern u32 e100_run_diag(struct net_device *dev, u64 *test_info, u32 flags);
static int e100_ethtool_test(struct net_device *, struct ifreq *);
#endif
#ifdef ETHTOOL_GSTRINGS
static int e100_ethtool_gstrings(struct net_device *, struct ifreq *);
static char *test_strings[] = {
"E100_EEPROM_TEST_FAIL",
"E100_CHIP_TIMEOUT",
"E100_ROM_TEST_FAIL",
"E100_REG_TEST_FAIL",
"E100_MAC_TEST_FAIL",
"E100_LPBK_MAC_FAIL",
"E100_LPBK_PHY_FAIL"
};
#endif #endif
#endif /*E100_ETHTOOL_IOCTL */ #endif /*E100_ETHTOOL_IOCTL */
...@@ -165,7 +182,7 @@ static void e100_non_tx_background(unsigned long); ...@@ -165,7 +182,7 @@ static void e100_non_tx_background(unsigned long);
/* Global Data structures and variables */ /* Global Data structures and variables */
char e100_copyright[] __devinitdata = "Copyright (c) 2002 Intel Corporation"; char e100_copyright[] __devinitdata = "Copyright (c) 2002 Intel Corporation";
#define E100_VERSION "2.0.24-pre1" #define E100_VERSION "2.0.25-pre1"
#define E100_FULL_DRIVER_NAME "Intel(R) PRO/100 Fast Ethernet Adapter - Loadable driver, ver " #define E100_FULL_DRIVER_NAME "Intel(R) PRO/100 Fast Ethernet Adapter - Loadable driver, ver "
...@@ -382,6 +399,7 @@ static void e100_set_multi_exec(struct net_device *dev); ...@@ -382,6 +399,7 @@ static void e100_set_multi_exec(struct net_device *dev);
MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
MODULE_DESCRIPTION(E100_FULL_DRIVER_NAME E100_VERSION); MODULE_DESCRIPTION(E100_FULL_DRIVER_NAME E100_VERSION);
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
EXPORT_NO_SYMBOLS;
E100_PARAM(TxDescriptors, "Number of transmit descriptors"); E100_PARAM(TxDescriptors, "Number of transmit descriptors");
E100_PARAM(RxDescriptors, "Number of receive descriptors"); E100_PARAM(RxDescriptors, "Number of receive descriptors");
...@@ -2715,8 +2733,10 @@ e100_exec_non_cu_cmd(struct e100_private *bdp, nxmit_cb_entry_t *command) ...@@ -2715,8 +2733,10 @@ e100_exec_non_cu_cmd(struct e100_private *bdp, nxmit_cb_entry_t *command)
ntcb_hdr->cb_lnk_ptr = 0; ntcb_hdr->cb_lnk_ptr = 0;
wmb(); wmb();
if (in_interrupt())
return e100_delayed_exec_non_cu_cmd(bdp, command);
if (in_interrupt() || netif_running(bdp->device)) if (netif_running(bdp->device) && (!bdp->driver_isolated))
return e100_delayed_exec_non_cu_cmd(bdp, command); return e100_delayed_exec_non_cu_cmd(bdp, command);
spin_lock_bh(&(bdp->bd_non_tx_lock)); spin_lock_bh(&(bdp->bd_non_tx_lock));
...@@ -3301,6 +3321,16 @@ e100_do_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr) ...@@ -3301,6 +3321,16 @@ e100_do_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr)
case ETHTOOL_SWOL: case ETHTOOL_SWOL:
rc = e100_ethtool_wol(dev, ifr); rc = e100_ethtool_wol(dev, ifr);
break; break;
#endif
#ifdef ETHTOOL_TEST
case ETHTOOL_TEST:
rc = e100_ethtool_test(dev, ifr);
break;
#endif
#ifdef ETHTOOL_GSTRINGS
case ETHTOOL_GSTRINGS:
rc = e100_ethtool_gstrings(dev,ifr);
break;
#endif #endif
default: default:
break; break;
...@@ -3464,6 +3494,36 @@ e100_ethtool_glink(struct net_device *dev, struct ifreq *ifr) ...@@ -3464,6 +3494,36 @@ e100_ethtool_glink(struct net_device *dev, struct ifreq *ifr)
} }
#endif #endif
#ifdef ETHTOOL_TEST
static int
e100_ethtool_test(struct net_device *dev, struct ifreq *ifr)
{
struct ethtool_test *info;
int rc = -EFAULT;
info = kmalloc(sizeof(*info) + E100_MAX_TEST_RES * sizeof(u64),
GFP_ATOMIC);
if (!info)
return -EFAULT;
memset((void *) info, 0, sizeof(*info) +
E100_MAX_TEST_RES * sizeof(u64));
if (copy_from_user(info, ifr->ifr_data, sizeof(*info)))
goto exit;
info->flags = e100_run_diag(dev, info->data, info->flags);
if (!copy_to_user(ifr->ifr_data, info,
sizeof(*info) + E100_MAX_TEST_RES * sizeof(u64)))
rc = 0;
exit:
kfree(info);
return rc;
}
#endif
#ifdef ETHTOOL_NWAY_RST #ifdef ETHTOOL_NWAY_RST
static int static int
e100_ethtool_nway_rst(struct net_device *dev, struct ifreq *ifr) e100_ethtool_nway_rst(struct net_device *dev, struct ifreq *ifr)
...@@ -3505,7 +3565,9 @@ e100_ethtool_get_drvinfo(struct net_device *dev, struct ifreq *ifr) ...@@ -3505,7 +3565,9 @@ e100_ethtool_get_drvinfo(struct net_device *dev, struct ifreq *ifr)
#ifdef ETHTOOL_GEEPROM #ifdef ETHTOOL_GEEPROM
info.eedump_len = (bdp->eeprom_size << 1); info.eedump_len = (bdp->eeprom_size << 1);
#endif #endif
#ifdef ETHTOOL_TEST
info.testinfo_len = E100_MAX_TEST_RES;
#endif
if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) if (copy_to_user(ifr->ifr_data, &info, sizeof (info)))
return -EFAULT; return -EFAULT;
...@@ -3737,6 +3799,51 @@ e100_ethtool_wol(struct net_device *dev, struct ifreq *ifr) ...@@ -3737,6 +3799,51 @@ e100_ethtool_wol(struct net_device *dev, struct ifreq *ifr)
return res; return res;
} }
#endif
#ifdef ETHTOOL_GSTRINGS
static int e100_ethtool_gstrings(struct net_device *dev, struct ifreq *ifr)
{
struct ethtool_gstrings info;
char *strings = NULL;
char *usr_strings;
int i;
memset((void *) &info, 0, sizeof(info));
usr_strings = (u8 *) (ifr->ifr_data +
offsetof(struct ethtool_gstrings, data));
if (copy_from_user(&info, ifr->ifr_data, sizeof (info)))
return -EFAULT;
switch (info.string_set) {
case ETH_SS_TEST:
if (info.len > E100_MAX_TEST_RES)
info.len = E100_MAX_TEST_RES;
strings = kmalloc(info.len * ETH_GSTRING_LEN, GFP_ATOMIC);
if (!strings)
return -EFAULT;
memset(strings, 0, info.len * ETH_GSTRING_LEN);
for (i = 0; i < info.len; i++) {
sprintf(strings + i * ETH_GSTRING_LEN, "%-31s",
test_strings[i]);
}
break;
default:
return -EOPNOTSUPP;
}
if (copy_to_user(ifr->ifr_data, &info, sizeof (info)))
return -EFAULT;
if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN))
return -EFAULT;
kfree(strings);
return 0;
}
#endif #endif
#endif /*E100_ETHTOOL_IOCTL */ #endif /*E100_ETHTOOL_IOCTL */
......
This diff is collapsed.
This software program is available to you under a choice of one of two This software program is available to you under a choice of one of two
licenses. You may choose to be licensed under either the GNU General Public licenses. You may choose to be licensed under either the GNU General Public
License (GPL) Version 2, June 1991, available at License 2.0, June 1991, available at http://www.fsf.org/copyleft/gpl.html,
http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License, the or the Intel BSD + Patent License, the text of which follows:
text of which follows:
Recipient has requested a license and Intel Corporation ("Intel") is willing Recipient has requested a license and Intel Corporation ("Intel") is willing
to grant a license for the software entitled Linux Base Driver for the to grant a license for the software entitled Linux Base Driver for the
...@@ -16,7 +15,7 @@ combined with the operating system referred to below. ...@@ -16,7 +15,7 @@ combined with the operating system referred to below.
"Recipient" means the party to whom Intel delivers this Software. "Recipient" means the party to whom Intel delivers this Software.
"Licensee" means Recipient and those third parties that receive a license to "Licensee" means Recipient and those third parties that receive a license to
any operating system available under the GNU Public License version 2.0 or any operating system available under the GNU General Public License 2.0 or
later. later.
Copyright (c) 1999 - 2002 Intel Corporation. Copyright (c) 1999 - 2002 Intel Corporation.
...@@ -49,10 +48,10 @@ not add functionality or features when the Software is incorporated in any ...@@ -49,10 +48,10 @@ not add functionality or features when the Software is incorporated in any
version of an operating system that has been distributed under the GNU version of an operating system that has been distributed under the GNU
General Public License 2.0 or later. This patent license shall apply to the General Public License 2.0 or later. This patent license shall apply to the
combination of the Software and any operating system licensed under the GNU combination of the Software and any operating system licensed under the GNU
Public License version 2.0 or later if, at the time Intel provides the General Public License 2.0 or later if, at the time Intel provides the
Software to Recipient, such addition of the Software to the then publicly Software to Recipient, such addition of the Software to the then publicly
available versions of such operating systems available under the GNU Public available versions of such operating systems available under the GNU General
License version 2.0 or later (whether in gold, beta or alpha form) causes Public License 2.0 or later (whether in gold, beta or alpha form) causes
such combination to be covered by the Licensed Patents. The patent license such combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Software. NO shall not apply to any other combinations which include the Software. NO
hardware per se is licensed hereunder. hardware per se is licensed hereunder.
......
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
O_TARGET := e1000.o O_TARGET := e1000.o
obj-y := e1000_main.o e1000_mac.o e1000_phy.o \ obj-y := e1000_main.o e1000_hw.o e1000_ethtool.o e1000_param.o e1000_proc.o
e1000_ethtool.o e1000_param.o e1000_proc.o
obj-m := $(O_TARGET) obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
This software program is available to you under a choice of one of two This software program is available to you under a choice of one of two
licenses. You may choose to be licensed under either the GNU General Public licenses. You may choose to be licensed under either the GNU General Public
License (GPL) Version 2, June 1991, available at License 2.0, June 1991, available at http://www.fsf.org/copyleft/gpl.html,
http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License, the or the Intel BSD + Patent License, the text of which follows:
text of which follows:
Recipient has requested a license and Intel Corporation ("Intel") is willing Recipient has requested a license and Intel Corporation ("Intel") is willing
to grant a license for the software entitled Linux Base Driver for the to grant a license for the software entitled Linux Base Driver for the
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
"Recipient" means the party to whom Intel delivers this Software. "Recipient" means the party to whom Intel delivers this Software.
"Licensee" means Recipient and those third parties that receive a license to "Licensee" means Recipient and those third parties that receive a license to
any operating system available under the GNU Public License version 2.0 or any operating system available under the GNU General Public License 2.0 or
later. later.
Copyright (c) 1999 - 2002 Intel Corporation. Copyright (c) 1999 - 2002 Intel Corporation.
...@@ -51,10 +50,10 @@ ...@@ -51,10 +50,10 @@
version of an operating system that has been distributed under the GNU version of an operating system that has been distributed under the GNU
General Public License 2.0 or later. This patent license shall apply to the General Public License 2.0 or later. This patent license shall apply to the
combination of the Software and any operating system licensed under the GNU combination of the Software and any operating system licensed under the GNU
Public License version 2.0 or later if, at the time Intel provides the General Public License 2.0 or later if, at the time Intel provides the
Software to Recipient, such addition of the Software to the then publicly Software to Recipient, such addition of the Software to the then publicly
available versions of such operating systems available under the GNU Public available versions of such operating systems available under the GNU General
License version 2.0 or later (whether in gold, beta or alpha form) causes Public License 2.0 or later (whether in gold, beta or alpha form) causes
such combination to be covered by the Licensed Patents. The patent license such combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Software. NO shall not apply to any other combinations which include the Software. NO
hardware per se is licensed hereunder. hardware per se is licensed hereunder.
...@@ -109,11 +108,14 @@ ...@@ -109,11 +108,14 @@
#include <net/pkt_sched.h> #include <net/pkt_sched.h>
#include <linux/list.h> #include <linux/list.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/ethtool.h>
#ifdef NETIF_F_HW_VLAN_TX
#include <linux/if_vlan.h>
#endif
struct e1000_adapter; struct e1000_adapter;
#include "e1000_mac.h" #include "e1000_hw.h"
#include "e1000_phy.h"
#define BAR_0 0 #define BAR_0 0
...@@ -138,7 +140,9 @@ struct e1000_adapter; ...@@ -138,7 +140,9 @@ struct e1000_adapter;
#define E1000_RXBUFFER_16384 16384 #define E1000_RXBUFFER_16384 16384
/* How many Tx Descriptors do we need to call netif_wake_queue ? */ /* How many Tx Descriptors do we need to call netif_wake_queue ? */
#define E1000_TX_QUEUE_WAKE 16 #define E1000_TX_QUEUE_WAKE 16
/* How many Rx Buffers do we bundle into one write to the hardware ? */
#define E1000_RX_BUFFER_WRITE 16
#define E1000_JUMBO_PBA 0x00000028 #define E1000_JUMBO_PBA 0x00000028
#define E1000_DEFAULT_PBA 0x00000030 #define E1000_DEFAULT_PBA 0x00000030
...@@ -163,10 +167,6 @@ struct e1000_desc_ring { ...@@ -163,10 +167,6 @@ struct e1000_desc_ring {
unsigned int size; unsigned int size;
/* number of descriptors in the ring */ /* number of descriptors in the ring */
unsigned int count; unsigned int count;
/* (atomic) number of desc with no buffer */
atomic_t unused;
/* number of desc with no buffer */
unsigned int unused_count;
/* next descriptor to associate a buffer with */ /* next descriptor to associate a buffer with */
unsigned int next_to_use; unsigned int next_to_use;
/* next descriptor to check for DD status bit */ /* next descriptor to check for DD status bit */
...@@ -175,14 +175,13 @@ struct e1000_desc_ring { ...@@ -175,14 +175,13 @@ struct e1000_desc_ring {
struct e1000_buffer *buffer_info; struct e1000_buffer *buffer_info;
}; };
#define E1000_RX_DESC(ring, i) \ #define E1000_DESC_UNUSED(R) \
(&(((struct e1000_rx_desc *)((ring).desc))[i])) ((((R)->next_to_clean + (R)->count) - ((R)->next_to_use + 1)) % ((R)->count))
#define E1000_TX_DESC(ring, i) \
(&(((struct e1000_tx_desc *)((ring).desc))[i]))
#define E1000_CONTEXT_DESC(ring, i) \ #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
(&(((struct e1000_context_desc *)((ring).desc))[i])) #define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
#define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
#define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
/* board specific private data structure */ /* board specific private data structure */
...@@ -191,6 +190,9 @@ struct e1000_adapter { ...@@ -191,6 +190,9 @@ struct e1000_adapter {
struct timer_list phy_info_timer; struct timer_list phy_info_timer;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
struct list_head proc_list_head; struct list_head proc_list_head;
#endif
#ifdef NETIF_F_HW_VLAN_TX
struct vlan_group *vlgrp;
#endif #endif
char *id_string; char *id_string;
uint32_t bd_number; uint32_t bd_number;
...@@ -201,28 +203,29 @@ struct e1000_adapter { ...@@ -201,28 +203,29 @@ struct e1000_adapter {
uint16_t link_duplex; uint16_t link_duplex;
spinlock_t stats_lock; spinlock_t stats_lock;
atomic_t irq_sem; atomic_t irq_sem;
boolean_t rx_csum;
/* TX */ /* TX */
struct e1000_desc_ring tx_ring; struct e1000_desc_ring tx_ring;
unsigned long trans_finish; unsigned long trans_finish;
uint32_t tx_int_delay; spinlock_t tx_lock;
uint32_t txd_cmd; uint32_t txd_cmd;
int max_data_per_txd;
/* RX */ /* RX */
struct e1000_desc_ring rx_ring; struct e1000_desc_ring rx_ring;
uint64_t hw_csum_err; uint64_t hw_csum_err;
uint64_t hw_csum_good; uint64_t hw_csum_good;
uint32_t rx_int_delay; uint32_t rx_int_delay;
boolean_t rx_csum;
/* OS defined structs */ /* OS defined structs */
struct net_device *netdev; struct net_device *netdev;
struct pci_dev *pdev; struct pci_dev *pdev;
struct net_device_stats net_stats; struct net_device_stats net_stats;
/* structs defined in e1000_mac.h or e1000_phy.h */ /* structs defined in e1000_hw.h */
struct e1000_shared_adapter shared; struct e1000_hw hw;
struct e1000_shared_stats stats; struct e1000_hw_stats stats;
struct e1000_phy_info phy_info; struct e1000_phy_info phy_info;
struct e1000_phy_stats phy_stats; struct e1000_phy_stats phy_stats;
}; };
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
This software program is available to you under a choice of one of two This software program is available to you under a choice of one of two
licenses. You may choose to be licensed under either the GNU General Public licenses. You may choose to be licensed under either the GNU General Public
License (GPL) Version 2, June 1991, available at License 2.0, June 1991, available at http://www.fsf.org/copyleft/gpl.html,
http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License, the or the Intel BSD + Patent License, the text of which follows:
text of which follows:
Recipient has requested a license and Intel Corporation ("Intel") is willing Recipient has requested a license and Intel Corporation ("Intel") is willing
to grant a license for the software entitled Linux Base Driver for the to grant a license for the software entitled Linux Base Driver for the
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
"Recipient" means the party to whom Intel delivers this Software. "Recipient" means the party to whom Intel delivers this Software.
"Licensee" means Recipient and those third parties that receive a license to "Licensee" means Recipient and those third parties that receive a license to
any operating system available under the GNU Public License version 2.0 or any operating system available under the GNU General Public License 2.0 or
later. later.
Copyright (c) 1999 - 2002 Intel Corporation. Copyright (c) 1999 - 2002 Intel Corporation.
...@@ -51,10 +50,10 @@ ...@@ -51,10 +50,10 @@
version of an operating system that has been distributed under the GNU version of an operating system that has been distributed under the GNU
General Public License 2.0 or later. This patent license shall apply to the General Public License 2.0 or later. This patent license shall apply to the
combination of the Software and any operating system licensed under the GNU combination of the Software and any operating system licensed under the GNU
Public License version 2.0 or later if, at the time Intel provides the General Public License 2.0 or later if, at the time Intel provides the
Software to Recipient, such addition of the Software to the then publicly Software to Recipient, such addition of the Software to the then publicly
available versions of such operating systems available under the GNU Public available versions of such operating systems available under the GNU General
License version 2.0 or later (whether in gold, beta or alpha form) causes Public License 2.0 or later (whether in gold, beta or alpha form) causes
such combination to be covered by the Licensed Patents. The patent license such combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Software. NO shall not apply to any other combinations which include the Software. NO
hardware per se is licensed hereunder. hardware per se is licensed hereunder.
...@@ -89,9 +88,9 @@ extern void e1000_enable_WOL(struct e1000_adapter *adapter); ...@@ -89,9 +88,9 @@ extern void e1000_enable_WOL(struct e1000_adapter *adapter);
static void static void
e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
{ {
struct e1000_shared_adapter *shared = &adapter->shared; struct e1000_hw *hw = &adapter->hw;
if(shared->media_type == e1000_media_type_copper) { if(hw->media_type == e1000_media_type_copper) {
ecmd->supported = (SUPPORTED_10baseT_Half | ecmd->supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
...@@ -103,18 +102,18 @@ e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) ...@@ -103,18 +102,18 @@ e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
ecmd->advertising = ADVERTISED_TP; ecmd->advertising = ADVERTISED_TP;
if(shared->autoneg == 1) { if(hw->autoneg == 1) {
ecmd->advertising |= ADVERTISED_Autoneg; ecmd->advertising |= ADVERTISED_Autoneg;
/* the e1000 autoneg seems to match ethtool nicely */ /* the e1000 autoneg seems to match ethtool nicely */
ecmd->advertising |= shared->autoneg_advertised; ecmd->advertising |= hw->autoneg_advertised;
} }
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
ecmd->phy_address = shared->phy_addr; ecmd->phy_address = hw->phy_addr;
if(shared->mac_type == e1000_82543) if(hw->mac_type == e1000_82543)
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
else else
ecmd->transceiver = XCVR_INTERNAL; ecmd->transceiver = XCVR_INTERNAL;
...@@ -129,13 +128,12 @@ e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) ...@@ -129,13 +128,12 @@ e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
SUPPORTED_Autoneg); SUPPORTED_Autoneg);
ecmd->port = PORT_FIBRE; ecmd->port = PORT_FIBRE;
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
} }
if(netif_carrier_ok(adapter->netdev)) { if(netif_carrier_ok(adapter->netdev)) {
e1000_get_speed_and_duplex(shared, &adapter->link_speed, e1000_get_speed_and_duplex(hw, &adapter->link_speed,
&adapter->link_duplex); &adapter->link_duplex);
ecmd->speed = adapter->link_speed; ecmd->speed = adapter->link_speed;
...@@ -151,37 +149,35 @@ e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) ...@@ -151,37 +149,35 @@ e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
ecmd->duplex = -1; ecmd->duplex = -1;
} }
ecmd->autoneg = (shared->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); ecmd->autoneg = (hw->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
return;
} }
static int static int
e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
{ {
struct e1000_shared_adapter *shared = &adapter->shared; struct e1000_hw *hw = &adapter->hw;
if(ecmd->autoneg == AUTONEG_ENABLE) { if(ecmd->autoneg == AUTONEG_ENABLE) {
shared->autoneg = 1; hw->autoneg = 1;
shared->autoneg_advertised = (ecmd->advertising & 0x002F); hw->autoneg_advertised = (ecmd->advertising & 0x002F);
} else { } else {
shared->autoneg = 0; hw->autoneg = 0;
switch(ecmd->speed + ecmd->duplex) { switch(ecmd->speed + ecmd->duplex) {
case SPEED_10 + DUPLEX_HALF: case SPEED_10 + DUPLEX_HALF:
shared->forced_speed_duplex = e1000_10_half; hw->forced_speed_duplex = e1000_10_half;
break; break;
case SPEED_10 + DUPLEX_FULL: case SPEED_10 + DUPLEX_FULL:
shared->forced_speed_duplex = e1000_10_full; hw->forced_speed_duplex = e1000_10_full;
break; break;
case SPEED_100 + DUPLEX_HALF: case SPEED_100 + DUPLEX_HALF:
shared->forced_speed_duplex = e1000_100_half; hw->forced_speed_duplex = e1000_100_half;
break; break;
case SPEED_100 + DUPLEX_FULL: case SPEED_100 + DUPLEX_FULL:
shared->forced_speed_duplex = e1000_100_full; hw->forced_speed_duplex = e1000_100_full;
break; break;
case SPEED_1000 + DUPLEX_FULL: case SPEED_1000 + DUPLEX_FULL:
shared->autoneg = 1; hw->autoneg = 1;
shared->autoneg_advertised = ADVERTISE_1000_FULL; hw->autoneg_advertised = ADVERTISE_1000_FULL;
break; break;
case SPEED_1000 + DUPLEX_HALF: /* not supported */ case SPEED_1000 + DUPLEX_HALF: /* not supported */
default: default:
...@@ -198,9 +194,13 @@ e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) ...@@ -198,9 +194,13 @@ e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
} }
static inline int static inline int
e1000_eeprom_size(struct e1000_shared_adapter *shared) e1000_eeprom_size(struct e1000_hw *hw)
{ {
return 128; if((hw->mac_type > e1000_82544) &&
(E1000_READ_REG(hw, EECD) & E1000_EECD_SIZE))
return 512;
else
return 128;
} }
static void static void
...@@ -211,36 +211,33 @@ e1000_ethtool_gdrvinfo(struct e1000_adapter *adapter, ...@@ -211,36 +211,33 @@ e1000_ethtool_gdrvinfo(struct e1000_adapter *adapter,
strncpy(drvinfo->version, e1000_driver_version, 32); strncpy(drvinfo->version, e1000_driver_version, 32);
strncpy(drvinfo->fw_version, "", 32); strncpy(drvinfo->fw_version, "", 32);
strncpy(drvinfo->bus_info, adapter->pdev->slot_name, 32); strncpy(drvinfo->bus_info, adapter->pdev->slot_name, 32);
drvinfo->eedump_len = e1000_eeprom_size(&adapter->shared); drvinfo->eedump_len = e1000_eeprom_size(&adapter->hw);
return;
} }
static void static void
e1000_ethtool_geeprom(struct e1000_adapter *adapter, e1000_ethtool_geeprom(struct e1000_adapter *adapter,
struct ethtool_eeprom *eeprom, uint16_t *eeprom_buff) struct ethtool_eeprom *eeprom, uint16_t *eeprom_buff)
{ {
struct e1000_shared_adapter *shared = &adapter->shared; struct e1000_hw *hw = &adapter->hw;
int i, max_len; int i, max_len;
eeprom->magic = shared->vendor_id | (shared->device_id << 16); eeprom->magic = hw->vendor_id | (hw->device_id << 16);
max_len = e1000_eeprom_size(shared); max_len = e1000_eeprom_size(hw);
if ((eeprom->offset + eeprom->len) > max_len) if ((eeprom->offset + eeprom->len) > max_len)
eeprom->len = (max_len - eeprom->offset); eeprom->len = (max_len - eeprom->offset);
for(i = 0; i < max_len; i++) for(i = 0; i < max_len; i++)
eeprom_buff[i] = e1000_read_eeprom(&adapter->shared, i); e1000_read_eeprom(&adapter->hw, i, &eeprom_buff[i]);
return;
} }
static void static void
e1000_ethtool_gwol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol) e1000_ethtool_gwol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol)
{ {
struct e1000_shared_adapter *shared = &adapter->shared; struct e1000_hw *hw = &adapter->hw;
if(shared->mac_type < e1000_82544) { if(hw->mac_type < e1000_82544) {
wol->supported = 0; wol->supported = 0;
wol->wolopts = 0; wol->wolopts = 0;
return; return;
...@@ -260,17 +257,15 @@ e1000_ethtool_gwol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol) ...@@ -260,17 +257,15 @@ e1000_ethtool_gwol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol)
wol->wolopts |= WAKE_BCAST; wol->wolopts |= WAKE_BCAST;
if(adapter->wol & E1000_WUFC_MAG) if(adapter->wol & E1000_WUFC_MAG)
wol->wolopts |= WAKE_MAGIC; wol->wolopts |= WAKE_MAGIC;
return;
} }
static int static int
e1000_ethtool_swol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol) e1000_ethtool_swol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol)
{ {
struct e1000_shared_adapter *shared = &adapter->shared; struct e1000_hw *hw = &adapter->hw;
if(shared->mac_type < e1000_82544) if(hw->mac_type < e1000_82544)
return wol->wolopts == 0 ? 0 : -EOPNOTSUPP; return wol->wolopts ? -EOPNOTSUPP : 0;
adapter->wol = 0; adapter->wol = 0;
......
This diff is collapsed.
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
This software program is available to you under a choice of one of two This software program is available to you under a choice of one of two
licenses. You may choose to be licensed under either the GNU General Public licenses. You may choose to be licensed under either the GNU General Public
License (GPL) Version 2, June 1991, available at License 2.0, June 1991, available at http://www.fsf.org/copyleft/gpl.html,
http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License, the or the Intel BSD + Patent License, the text of which follows:
text of which follows:
Recipient has requested a license and Intel Corporation ("Intel") is willing Recipient has requested a license and Intel Corporation ("Intel") is willing
to grant a license for the software entitled Linux Base Driver for the to grant a license for the software entitled Linux Base Driver for the
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
"Recipient" means the party to whom Intel delivers this Software. "Recipient" means the party to whom Intel delivers this Software.
"Licensee" means Recipient and those third parties that receive a license to "Licensee" means Recipient and those third parties that receive a license to
any operating system available under the GNU Public License version 2.0 or any operating system available under the GNU General Public License 2.0 or
later. later.
Copyright (c) 1999 - 2002 Intel Corporation. Copyright (c) 1999 - 2002 Intel Corporation.
...@@ -51,10 +50,10 @@ ...@@ -51,10 +50,10 @@
version of an operating system that has been distributed under the GNU version of an operating system that has been distributed under the GNU
General Public License 2.0 or later. This patent license shall apply to the General Public License 2.0 or later. This patent license shall apply to the
combination of the Software and any operating system licensed under the GNU combination of the Software and any operating system licensed under the GNU
Public License version 2.0 or later if, at the time Intel provides the General Public License 2.0 or later if, at the time Intel provides the
Software to Recipient, such addition of the Software to the then publicly Software to Recipient, such addition of the Software to the then publicly
available versions of such operating systems available under the GNU Public available versions of such operating systems available under the GNU General
License version 2.0 or later (whether in gold, beta or alpha form) causes Public License 2.0 or later (whether in gold, beta or alpha form) causes
such combination to be covered by the Licensed Patents. The patent license such combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Software. NO shall not apply to any other combinations which include the Software. NO
hardware per se is licensed hereunder. hardware per se is licensed hereunder.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -72,7 +72,7 @@ static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0}; ...@@ -72,7 +72,7 @@ static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0};
#define E21_SAPROM 0x10 /* Offset to station address data. */ #define E21_SAPROM 0x10 /* Offset to station address data. */
#define E21_IO_EXTENT 0x20 #define E21_IO_EXTENT 0x20
extern inline void mem_on(short port, volatile char *mem_base, static inline void mem_on(short port, volatile char *mem_base,
unsigned char start_page ) unsigned char start_page )
{ {
/* This is a little weird: set the shared memory window by doing a /* This is a little weird: set the shared memory window by doing a
...@@ -82,7 +82,7 @@ extern inline void mem_on(short port, volatile char *mem_base, ...@@ -82,7 +82,7 @@ extern inline void mem_on(short port, volatile char *mem_base,
outb(E21_MEM_ON, port + E21_MEM_ENABLE + E21_MEM_ON); outb(E21_MEM_ON, port + E21_MEM_ENABLE + E21_MEM_ON);
} }
extern inline void mem_off(short port) static inline void mem_off(short port)
{ {
inb(port + E21_MEM_ENABLE); inb(port + E21_MEM_ENABLE);
outb(0x00, port + E21_MEM_ENABLE); outb(0x00, port + E21_MEM_ENABLE);
...@@ -234,8 +234,8 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr) ...@@ -234,8 +234,8 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
#ifdef notdef #ifdef notdef
/* These values are unused. The E2100 has a 2K window into the packet /* These values are unused. The E2100 has a 2K window into the packet
buffer. The window can be set to start on any page boundary. */ buffer. The window can be set to start on any page boundary. */
dev->rmem_start = dev->mem_start + TX_PAGES*256; ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
dev->mem_end = dev->rmem_end = dev->mem_start + 2*1024; dev->mem_end = ei_status.rmem_end = dev->mem_start + 2*1024;
#endif #endif
printk(", IRQ %d, %s media, memory @ %#lx.\n", dev->irq, printk(", IRQ %d, %s media, memory @ %#lx.\n", dev->irq,
......
...@@ -1795,6 +1795,7 @@ speedo_rx(struct net_device *dev) ...@@ -1795,6 +1795,7 @@ speedo_rx(struct net_device *dev)
} }
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
dev->last_rx = jiffies;
sp->stats.rx_packets++; sp->stats.rx_packets++;
sp->stats.rx_bytes += pkt_len; sp->stats.rx_bytes += pkt_len;
} }
......
...@@ -60,11 +60,14 @@ ...@@ -60,11 +60,14 @@
LK1.1.12: LK1.1.12:
* fix power-up sequence * fix power-up sequence
LK1.1.13:
* revert version 1.1.12, power-up sequence "fix"
*/ */
#define DRV_NAME "epic100" #define DRV_NAME "epic100"
#define DRV_VERSION "1.11+LK1.1.12" #define DRV_VERSION "1.11+LK1.1.13"
#define DRV_RELDATE "Jan 18, 2002" #define DRV_RELDATE "Mar 20, 2002"
/* The user-configurable values. /* The user-configurable values.
...@@ -678,8 +681,9 @@ static int epic_open(struct net_device *dev) ...@@ -678,8 +681,9 @@ static int epic_open(struct net_device *dev)
required by the details of which bits are reset and the transceiver required by the details of which bits are reset and the transceiver
wiring on the Ositech CardBus card. wiring on the Ositech CardBus card.
*/ */
#if 0
outl(0x12, ioaddr + MIICfg); outl(dev->if_port == 1 ? 0x13 : 0x12, ioaddr + MIICfg);
#endif
if (ep->chip_flags & MII_PWRDWN) if (ep->chip_flags & MII_PWRDWN)
outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
......
...@@ -233,9 +233,9 @@ static int __init es_probe1(struct net_device *dev, int ioaddr) ...@@ -233,9 +233,9 @@ static int __init es_probe1(struct net_device *dev, int ioaddr)
printk(" assigning "); printk(" assigning ");
} }
dev->mem_end = dev->rmem_end = dev->mem_start dev->mem_end = ei_status.rmem_end = dev->mem_start
+ (ES_STOP_PG - ES_START_PG)*256; + (ES_STOP_PG - ES_START_PG)*256;
dev->rmem_start = dev->mem_start + TX_PAGES*256; ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
printk("mem %#lx-%#lx\n", dev->mem_start, dev->mem_end-1); printk("mem %#lx-%#lx\n", dev->mem_start, dev->mem_end-1);
...@@ -335,12 +335,12 @@ static void es_block_input(struct net_device *dev, int count, struct sk_buff *sk ...@@ -335,12 +335,12 @@ static void es_block_input(struct net_device *dev, int count, struct sk_buff *sk
{ {
unsigned long xfer_start = dev->mem_start + ring_offset - (ES_START_PG<<8); unsigned long xfer_start = dev->mem_start + ring_offset - (ES_START_PG<<8);
if (xfer_start + count > dev->rmem_end) { if (xfer_start + count > ei_status.rmem_end) {
/* Packet wraps over end of ring buffer. */ /* Packet wraps over end of ring buffer. */
int semi_count = dev->rmem_end - xfer_start; int semi_count = ei_status.rmem_end - xfer_start;
isa_memcpy_fromio(skb->data, xfer_start, semi_count); isa_memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count; count -= semi_count;
isa_memcpy_fromio(skb->data + semi_count, dev->rmem_start, count); isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
} else { } else {
/* Packet is in one chunk. */ /* Packet is in one chunk. */
isa_eth_io_copy_and_sum(skb, xfer_start, count, 0); isa_eth_io_copy_and_sum(skb, xfer_start, count, 0);
......
...@@ -256,7 +256,7 @@ static void sp_bump(struct sixpack *sp, char cmd) ...@@ -256,7 +256,7 @@ static void sp_bump(struct sixpack *sp, char cmd)
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
skb->protocol = htons(ETH_P_AX25); skb->protocol = htons(ETH_P_AX25);
netif_rx(skb); netif_rx(skb);
dev->last_rx = jiffies; sp->dev->last_rx = jiffies;
sp->stats.rx_packets++; sp->stats.rx_packets++;
} }
...@@ -701,7 +701,6 @@ static struct tty_ldisc sp_ldisc = { ...@@ -701,7 +701,6 @@ static struct tty_ldisc sp_ldisc = {
/* Initialize 6pack control device -- register 6pack line discipline */ /* Initialize 6pack control device -- register 6pack line discipline */
static char msg_banner[] __initdata = KERN_INFO "AX.25: 6pack driver, " SIXPACK_VERSION " (dynamic channels, max=%d)\n"; static char msg_banner[] __initdata = KERN_INFO "AX.25: 6pack driver, " SIXPACK_VERSION " (dynamic channels, max=%d)\n";
static char msg_invparm[] __initdata = KERN_ERR "6pack: sixpack_maxdev parameter too large.\n";
static char msg_nomem[] __initdata = KERN_ERR "6pack: can't allocate sixpack_ctrls[] array! No 6pack available.\n"; static char msg_nomem[] __initdata = KERN_ERR "6pack: can't allocate sixpack_ctrls[] array! No 6pack available.\n";
static char msg_regfail[] __initdata = KERN_ERR "6pack: can't register line discipline (err = %d)\n"; static char msg_regfail[] __initdata = KERN_ERR "6pack: can't register line discipline (err = %d)\n";
......
...@@ -302,7 +302,7 @@ static const unsigned short crc_ccitt_table[] = { ...@@ -302,7 +302,7 @@ static const unsigned short crc_ccitt_table[] = {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if 0 #if 0
extern inline void append_crc_ccitt(unsigned char *buffer, int len) static inline void append_crc_ccitt(unsigned char *buffer, int len)
{ {
unsigned int crc = 0xffff; unsigned int crc = 0xffff;
...@@ -316,7 +316,7 @@ extern inline void append_crc_ccitt(unsigned char *buffer, int len) ...@@ -316,7 +316,7 @@ extern inline void append_crc_ccitt(unsigned char *buffer, int len)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
extern inline int check_crc_ccitt(const unsigned char *buf, int cnt) static inline int check_crc_ccitt(const unsigned char *buf, int cnt)
{ {
unsigned int crc = 0xffff; unsigned int crc = 0xffff;
...@@ -327,7 +327,7 @@ extern inline int check_crc_ccitt(const unsigned char *buf, int cnt) ...@@ -327,7 +327,7 @@ extern inline int check_crc_ccitt(const unsigned char *buf, int cnt)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
extern inline int calc_crc_ccitt(const unsigned char *buf, int cnt) static inline int calc_crc_ccitt(const unsigned char *buf, int cnt)
{ {
unsigned int crc = 0xffff; unsigned int crc = 0xffff;
......
...@@ -201,12 +201,12 @@ static inline void ser12_set_divisor(struct net_device *dev, ...@@ -201,12 +201,12 @@ static inline void ser12_set_divisor(struct net_device *dev,
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#if 0 #if 0
extern inline unsigned int hweight16(unsigned int w) static inline unsigned int hweight16(unsigned int w)
__attribute__ ((unused)); __attribute__ ((unused));
extern inline unsigned int hweight8(unsigned int w) static inline unsigned int hweight8(unsigned int w)
__attribute__ ((unused)); __attribute__ ((unused));
extern inline unsigned int hweight16(unsigned int w) static inline unsigned int hweight16(unsigned int w)
{ {
unsigned short res = (w & 0x5555) + ((w >> 1) & 0x5555); unsigned short res = (w & 0x5555) + ((w >> 1) & 0x5555);
res = (res & 0x3333) + ((res >> 2) & 0x3333); res = (res & 0x3333) + ((res >> 2) & 0x3333);
...@@ -214,7 +214,7 @@ extern inline unsigned int hweight16(unsigned int w) ...@@ -214,7 +214,7 @@ extern inline unsigned int hweight16(unsigned int w)
return (res & 0x00FF) + ((res >> 8) & 0x00FF); return (res & 0x00FF) + ((res >> 8) & 0x00FF);
} }
extern inline unsigned int hweight8(unsigned int w) static inline unsigned int hweight8(unsigned int w)
{ {
unsigned short res = (w & 0x55) + ((w >> 1) & 0x55); unsigned short res = (w & 0x55) + ((w >> 1) & 0x55);
res = (res & 0x33) + ((res >> 2) & 0x33); res = (res & 0x33) + ((res >> 2) & 0x33);
......
...@@ -1121,6 +1121,7 @@ static void rx_bh(void *arg) { ...@@ -1121,6 +1121,7 @@ static void rx_bh(void *arg) {
skb->protocol = ntohs(ETH_P_AX25); skb->protocol = ntohs(ETH_P_AX25);
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
netif_rx(skb); netif_rx(skb);
priv->dev->last_rx = jiffies;
priv->stats.rx_packets++; priv->stats.rx_packets++;
priv->stats.rx_bytes += cb; priv->stats.rx_bytes += cb;
} }
......
...@@ -345,7 +345,7 @@ static void ax_bump(struct ax_disp *ax) ...@@ -345,7 +345,7 @@ static void ax_bump(struct ax_disp *ax)
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
skb->protocol = htons(ETH_P_AX25); skb->protocol = htons(ETH_P_AX25);
netif_rx(skb); netif_rx(skb);
dev->last_rx = jiffies; tmp_ax->dev->last_rx = jiffies;
tmp_ax->rx_packets++; tmp_ax->rx_packets++;
} }
......
...@@ -1661,7 +1661,7 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb) ...@@ -1661,7 +1661,7 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb)
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
netif_rx(skb); netif_rx(skb);
dev->last_rx = jiffies; scc->dev->last_rx = jiffies;
return; return;
} }
......
This diff is collapsed.
...@@ -94,7 +94,7 @@ static void modulator_1200_s16(struct sm_state *sm, short *buf, unsigned int buf ...@@ -94,7 +94,7 @@ static void modulator_1200_s16(struct sm_state *sm, short *buf, unsigned int buf
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
extern __inline__ int convolution8_u8(const unsigned char *st, const int *coeff, int csum) static __inline__ int convolution8_u8(const unsigned char *st, const int *coeff, int csum)
{ {
int sum = -0x80 * csum; int sum = -0x80 * csum;
...@@ -111,7 +111,7 @@ extern __inline__ int convolution8_u8(const unsigned char *st, const int *coeff, ...@@ -111,7 +111,7 @@ extern __inline__ int convolution8_u8(const unsigned char *st, const int *coeff,
return sum * sum; return sum * sum;
} }
extern __inline__ int convolution8_s16(const short *st, const int *coeff, int csum) static __inline__ int convolution8_s16(const short *st, const int *coeff, int csum)
{ {
int sum = 0; int sum = 0;
...@@ -128,7 +128,7 @@ extern __inline__ int convolution8_s16(const short *st, const int *coeff, int cs ...@@ -128,7 +128,7 @@ extern __inline__ int convolution8_s16(const short *st, const int *coeff, int cs
return sum * sum; return sum * sum;
} }
extern __inline__ int do_filter_1200_u8(const unsigned char *buf) static __inline__ int do_filter_1200_u8(const unsigned char *buf)
{ {
int sum = convolution8_u8(buf, afsk12_tx_lo_i, SUM_AFSK12_TX_LO_I); int sum = convolution8_u8(buf, afsk12_tx_lo_i, SUM_AFSK12_TX_LO_I);
sum += convolution8_u8(buf, afsk12_tx_lo_q, SUM_AFSK12_TX_LO_Q); sum += convolution8_u8(buf, afsk12_tx_lo_q, SUM_AFSK12_TX_LO_Q);
...@@ -137,7 +137,7 @@ extern __inline__ int do_filter_1200_u8(const unsigned char *buf) ...@@ -137,7 +137,7 @@ extern __inline__ int do_filter_1200_u8(const unsigned char *buf)
return sum; return sum;
} }
extern __inline__ int do_filter_1200_s16(const short *buf) static __inline__ int do_filter_1200_s16(const short *buf)
{ {
int sum = convolution8_s16(buf, afsk12_tx_lo_i, SUM_AFSK12_TX_LO_I); int sum = convolution8_s16(buf, afsk12_tx_lo_i, SUM_AFSK12_TX_LO_I);
sum += convolution8_s16(buf, afsk12_tx_lo_q, SUM_AFSK12_TX_LO_Q); sum += convolution8_s16(buf, afsk12_tx_lo_q, SUM_AFSK12_TX_LO_Q);
......
...@@ -104,7 +104,7 @@ static void modulator_2400_s16(struct sm_state *sm, short *buf, unsigned int buf ...@@ -104,7 +104,7 @@ static void modulator_2400_s16(struct sm_state *sm, short *buf, unsigned int buf
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
extern __inline__ int convolution14_u8(const unsigned char *st, const int *coeff, int csum) static __inline__ int convolution14_u8(const unsigned char *st, const int *coeff, int csum)
{ {
int sum = -0x80 * csum; int sum = -0x80 * csum;
...@@ -127,7 +127,7 @@ extern __inline__ int convolution14_u8(const unsigned char *st, const int *coeff ...@@ -127,7 +127,7 @@ extern __inline__ int convolution14_u8(const unsigned char *st, const int *coeff
return sum * sum; return sum * sum;
} }
extern __inline__ int convolution14_s16(const short *st, const int *coeff, int csum) static __inline__ int convolution14_s16(const short *st, const int *coeff, int csum)
{ {
int sum = 0; int sum = 0;
...@@ -150,7 +150,7 @@ extern __inline__ int convolution14_s16(const short *st, const int *coeff, int c ...@@ -150,7 +150,7 @@ extern __inline__ int convolution14_s16(const short *st, const int *coeff, int c
return sum * sum; return sum * sum;
} }
extern __inline__ int do_filter_2400_u8(const unsigned char *buf) static __inline__ int do_filter_2400_u8(const unsigned char *buf)
{ {
int sum = convolution14_u8(buf, afsk24_tx_lo_i, SUM_AFSK24_TX_LO_I); int sum = convolution14_u8(buf, afsk24_tx_lo_i, SUM_AFSK24_TX_LO_I);
sum += convolution14_u8(buf, afsk24_tx_lo_q, SUM_AFSK24_TX_LO_Q); sum += convolution14_u8(buf, afsk24_tx_lo_q, SUM_AFSK24_TX_LO_Q);
...@@ -159,7 +159,7 @@ extern __inline__ int do_filter_2400_u8(const unsigned char *buf) ...@@ -159,7 +159,7 @@ extern __inline__ int do_filter_2400_u8(const unsigned char *buf)
return sum; return sum;
} }
extern __inline__ int do_filter_2400_s16(const short *buf) static __inline__ int do_filter_2400_s16(const short *buf)
{ {
int sum = convolution14_s16(buf, afsk24_tx_lo_i, SUM_AFSK24_TX_LO_I); int sum = convolution14_s16(buf, afsk24_tx_lo_i, SUM_AFSK24_TX_LO_I);
sum += convolution14_s16(buf, afsk24_tx_lo_q, SUM_AFSK24_TX_LO_Q); sum += convolution14_s16(buf, afsk24_tx_lo_q, SUM_AFSK24_TX_LO_Q);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment