patch-2.4.0-test11 linux/drivers/net/de4x5.c
Next file: linux/drivers/net/de600.c
Previous file: linux/drivers/net/cs89x0.c
Back to the patch index
Back to the overall index
- Lines: 70
- Date:
Wed Nov 8 17:09:50 2000
- Orig file:
v2.4.0-test10/linux/drivers/net/de4x5.c
- Orig date:
Thu Jul 13 11:11:10 2000
diff -u --recursive --new-file v2.4.0-test10/linux/drivers/net/de4x5.c linux/drivers/net/de4x5.c
@@ -766,6 +766,20 @@
#define DE4X5_PKT_BIN_SZ 128 /* Should be >=100 unless you
increase DE4X5_PKT_STAT_SZ */
+struct pkt_stats {
+ u_int bins[DE4X5_PKT_STAT_SZ]; /* Private stats counters */
+ u_int unicast;
+ u_int multicast;
+ u_int broadcast;
+ u_int excessive_collisions;
+ u_int tx_underruns;
+ u_int excessive_underruns;
+ u_int rx_runt_frames;
+ u_int rx_collision;
+ u_int rx_dribble;
+ u_int rx_overflow;
+};
+
struct de4x5_private {
char adapter_name[80]; /* Adapter name */
u_long interrupt; /* Aligned ISR flag */
@@ -779,19 +793,7 @@
char frame[64]; /* Min sized packet for loopback*/
spinlock_t lock; /* Adapter specific spinlock */
struct net_device_stats stats; /* Public stats */
- struct {
- u_int bins[DE4X5_PKT_STAT_SZ]; /* Private stats counters */
- u_int unicast;
- u_int multicast;
- u_int broadcast;
- u_int excessive_collisions;
- u_int tx_underruns;
- u_int excessive_underruns;
- u_int rx_runt_frames;
- u_int rx_collision;
- u_int rx_dribble;
- u_int rx_overflow;
- } pktStats;
+ struct pkt_stats pktStats; /* Private stats counters */
char rxRingSize;
char txRingSize;
int bus; /* EISA or PCI */
@@ -5639,6 +5641,7 @@
break;
case DE4X5_SAY_BOO: /* Say "Boo!" to the kernel log file */
+ if (!capable(CAP_NET_ADMIN)) return -EPERM;
printk("%s: Boo!\n", dev->name);
break;
@@ -5650,12 +5653,16 @@
break;
case DE4X5_GET_STATS: /* Get the driver statistics */
- ioc->len = sizeof(lp->pktStats);
+ {
+ struct pkt_stats statbuf;
+ ioc->len = sizeof(statbuf);
spin_lock_irqsave(&lp->lock, flags);
- if (copy_to_user(ioc->data, &lp->pktStats, ioc->len)) return -EFAULT;
+ memcpy(&statbuf, &lp->pktStats, ioc->len);
spin_unlock_irqrestore(&lp->lock, flags);
+ if (copy_to_user(ioc->data, &statbuf, ioc->len))
+ return -EFAULT;
break;
-
+ }
case DE4X5_CLR_STATS: /* Zero out the driver statistics */
if (!capable(CAP_NET_ADMIN)) return -EPERM;
spin_lock_irqsave(&lp->lock, flags);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)