patch-2.4.20 linux-2.4.20/drivers/net/fealnx.c
Next file: linux-2.4.20/drivers/net/gmac.c
Previous file: linux-2.4.20/drivers/net/ewrk3.c
Back to the patch index
Back to the overall index
- Lines: 99
- Date:
Thu Nov 28 15:53:13 2002
- Orig file:
linux-2.4.19/drivers/net/fealnx.c
- Orig date:
Fri Aug 2 17:39:44 2002
diff -urN linux-2.4.19/drivers/net/fealnx.c linux-2.4.20/drivers/net/fealnx.c
@@ -559,6 +559,8 @@
np->mii.dev = dev;
np->mii.mdio_read = mdio_read;
np->mii.mdio_write = mdio_write;
+ np->mii.phy_id_mask = 0x1f;
+ np->mii.reg_num_mask = 0x1f;
ring_space = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
if (!ring_space) {
@@ -654,7 +656,7 @@
mdio_write(dev, np->phys[0], MII_ADVERTISE, ADVERTISE_FULL);
else
writel(ADVERTISE_FULL, dev->base_addr + ANARANLPAR);
- np->mii.duplex_lock = 1;
+ np->mii.force_media = 1;
}
/* The chip-specific entries in the device structure. */
@@ -956,7 +958,7 @@
// 89/9/1 modify,
// np->crvalue = 0x00e40001; /* tx store and forward, tx/rx enable */
np->crvalue |= 0x00e40001; /* tx store and forward, tx/rx enable */
- np->mii.full_duplex = np->mii.duplex_lock;
+ np->mii.full_duplex = np->mii.force_media;
getlinkstatus(dev);
if (np->linkok)
getlinktype(dev);
@@ -1493,16 +1495,7 @@
if ((tx_status & HF) && np->mii.full_duplex == 0)
np->stats.tx_heartbeat_errors++;
-#ifdef ETHER_STATS
- if (tx_status & EC)
- np->stats.collisions16++;
-#endif
} else {
-#ifdef ETHER_STATS
- if (tx_status & DFR)
- np->stats.tx_deferred++;
-#endif
-
np->stats.tx_bytes +=
((tx_control & PKTSMask) >> PKTSShift);
@@ -1544,9 +1537,6 @@
np->stats.tx_errors += (data & 0xff000000) >> 24;
np->stats.tx_aborted_errors += (data & 0xff000000) >> 24;
np->stats.tx_window_errors += (data & 0x00ff0000) >> 16;
-#ifdef ETHER_STATS
- np->stats.collisions16 += (data & 0xff000000) >> 24;
-#endif
np->stats.collisions += (data & 0x0000ffff);
}
@@ -1845,31 +1835,23 @@
static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
+ struct netdev_private *np = dev->priv;
struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
+ int rc;
- switch (cmd) {
- case SIOCETHTOOL:
- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
-
- case SIOCGMIIPHY: /* Get address of MII PHY in use. */
- case SIOCDEVPRIVATE: /* for binary compat, remove in 2.5 */
- data->phy_id = ((struct netdev_private *) dev->priv)->phys[0] & 0x1f;
- /* Fall Through */
-
- case SIOCGMIIREG: /* Read MII PHY register. */
- case SIOCDEVPRIVATE+1: /* for binary compat, remove in 2.5 */
- data->val_out = mdio_read(dev, data->phy_id & 0x1f, data->reg_num & 0x1f);
- return 0;
+ if (!netif_running(dev))
+ return -EINVAL;
- case SIOCSMIIREG: /* Write MII PHY register. */
- case SIOCDEVPRIVATE+2: /* for binary compat, remove in 2.5 */
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
- mdio_write(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
- return 0;
- default:
- return -EOPNOTSUPP;
+ if (cmd == SIOCETHTOOL)
+ rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+
+ else {
+ spin_lock_irq(&np->lock);
+ rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
+ spin_unlock_irq(&np->lock);
}
+
+ return rc;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)