Commit a7928f54 authored by Jeff Garzik's avatar Jeff Garzik

Remove cli/sti from ewrk3 net driver.

Also, comment out ETHTOOL_PHYS_ID until its sleeping is fixed.

Originally by Denis Vlasenko, then via Adam Kropelin, and
finally cleaned up by me.
parent a7a8afcf
...@@ -262,20 +262,22 @@ static int ewrk3_debug = 1; ...@@ -262,20 +262,22 @@ static int ewrk3_debug = 1;
#define EWRK3_PKT_BIN_SZ 128 /* Should be >=100 unless you #define EWRK3_PKT_BIN_SZ 128 /* Should be >=100 unless you
increase EWRK3_PKT_STAT_SZ */ increase EWRK3_PKT_STAT_SZ */
struct ewrk3_stats {
u32 bins[EWRK3_PKT_STAT_SZ];
u32 unicast;
u32 multicast;
u32 broadcast;
u32 excessive_collisions;
u32 tx_underruns;
u32 excessive_underruns;
};
struct ewrk3_private { struct ewrk3_private {
char adapter_name[80]; /* Name exported to /proc/ioports */ char adapter_name[80]; /* Name exported to /proc/ioports */
u_long shmem_base; /* Shared memory start address */ u_long shmem_base; /* Shared memory start address */
u_long shmem_length; /* Shared memory window length */ u_long shmem_length; /* Shared memory window length */
struct net_device_stats stats; /* Public stats */ struct net_device_stats stats; /* Public stats */
struct { struct ewrk3_stats pktStats; /* Private stats counters */
u32 bins[EWRK3_PKT_STAT_SZ]; /* Private stats counters */
u32 unicast;
u32 multicast;
u32 broadcast;
u32 excessive_collisions;
u32 tx_underruns;
u32 excessive_underruns;
} pktStats;
u_char irq_mask; /* Adapter IRQ mask bits */ u_char irq_mask; /* Adapter IRQ mask bits */
u_char mPage; /* Maximum 2kB Page number */ u_char mPage; /* Maximum 2kB Page number */
u_char lemac; /* Chip rev. level */ u_char lemac; /* Chip rev. level */
...@@ -940,6 +942,7 @@ static void ewrk3_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -940,6 +942,7 @@ static void ewrk3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
spin_unlock(&lp->hw_lock); spin_unlock(&lp->hw_lock);
} }
/* Called with lp->hw_lock held */
static int ewrk3_rx(struct net_device *dev) static int ewrk3_rx(struct net_device *dev)
{ {
struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv; struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
...@@ -1065,8 +1068,9 @@ static int ewrk3_rx(struct net_device *dev) ...@@ -1065,8 +1068,9 @@ static int ewrk3_rx(struct net_device *dev)
} }
/* /*
** Buffer sent - check for TX buffer errors. ** Buffer sent - check for TX buffer errors.
*/ ** Called with lp->hw_lock held
*/
static int ewrk3_tx(struct net_device *dev) static int ewrk3_tx(struct net_device *dev)
{ {
struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv; struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
...@@ -1760,6 +1764,7 @@ static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1760,6 +1764,7 @@ static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr)
return 0; return 0;
} }
#ifdef BROKEN
/* Blink LED for identification */ /* Blink LED for identification */
case ETHTOOL_PHYS_ID: { case ETHTOOL_PHYS_ID: {
struct ethtool_value edata; struct ethtool_value edata;
...@@ -1813,6 +1818,7 @@ static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1813,6 +1818,7 @@ static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr)
spin_unlock_irqrestore(&lp->hw_lock, flags); spin_unlock_irqrestore(&lp->hw_lock, flags);
return ret; return ret;
} }
#endif /* BROKEN */
} }
...@@ -1830,6 +1836,7 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1830,6 +1836,7 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
u_long iobase = dev->base_addr; u_long iobase = dev->base_addr;
int i, j, status = 0; int i, j, status = 0;
u_char csr; u_char csr;
unsigned long flags;
union ewrk3_addr { union ewrk3_addr {
u_char addr[HASH_TABLE_LEN * ETH_ALEN]; u_char addr[HASH_TABLE_LEN * ETH_ALEN];
u_short val[(HASH_TABLE_LEN * ETH_ALEN) >> 1]; u_short val[(HASH_TABLE_LEN * ETH_ALEN) >> 1];
...@@ -1953,19 +1960,26 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1953,19 +1960,26 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
} }
break; break;
case EWRK3_GET_STATS: /* Get the driver statistics */ case EWRK3_GET_STATS: { /* Get the driver statistics */
cli(); struct ewrk3_stats *tmp_stats =
ioc->len = sizeof(lp->pktStats); kmalloc(sizeof(lp->pktStats), GFP_KERNEL);
if (copy_to_user(ioc->data, &lp->pktStats, ioc->len)) if (!tmp_stats) return -ENOMEM;
status = -EFAULT;
sti();
spin_lock_irqsave(&lp->hw_lock, flags);
memcpy(tmp_stats, &lp->pktStats, sizeof(lp->pktStats));
spin_unlock_irqrestore(&lp->hw_lock, flags);
ioc->len = sizeof(lp->pktStats);
if (copy_to_user(ioc->data, tmp_stats, sizeof(lp->pktStats)))
status = -EFAULT;
kfree(tmp_stats);
break; break;
}
case EWRK3_CLR_STATS: /* Zero out the driver statistics */ case EWRK3_CLR_STATS: /* Zero out the driver statistics */
if (capable(CAP_NET_ADMIN)) { if (capable(CAP_NET_ADMIN)) {
cli(); spin_lock_irqsave(&lp->hw_lock, flags);
memset(&lp->pktStats, 0, sizeof(lp->pktStats)); memset(&lp->pktStats, 0, sizeof(lp->pktStats));
sti(); spin_unlock_irqrestore(&lp->hw_lock,flags);
} else { } else {
status = -EPERM; status = -EPERM;
} }
......
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