From: Roger Luethi <rl@hellgate.ch>
To: Jeff Garzik <jgarzik@pobox.com>,
Linus Torvalds <torvalds@transmeta.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@digeo.com>
Subject: [1/4][via-rhine][PATCH] Trivial changes; not affecting functionality
Date: Sat, 15 Feb 2003 12:18:12 +0100 [thread overview]
Message-ID: <20030215111812.GA11525@k3.hellgate.ch> (raw)
In-Reply-To: <20030215111705.GA11127@k3.hellgate.ch>
[-- Attachment #1: Type: text/plain, Size: 164 bytes --]
- nuke mii_status_bits
- move clear_tally_counters() up so it can get inlined (pointed out by
Luca Barbieri)
- rename via_restart_tx() -> via_rhine_restart_tx()
[-- Attachment #2: via-rhine-1.16rc-01_trivial.diff --]
[-- Type: text/plain, Size: 4388 bytes --]
--- 00_2.5.61/drivers/net/via-rhine.c Sat Feb 15 10:42:53 2003
+++ 01_trivial/drivers/net/via-rhine.c Fri Feb 14 18:09:48 2003
@@ -425,20 +425,6 @@ enum intr_status_bits {
IntrNormalSummary=0x0003, IntrAbnormalSummary=0xC260,
};
-/* MII interface, status flags.
- Not to be confused with the MIIStatus register ... */
-enum mii_status_bits {
- MIICap100T4 = 0x8000,
- MIICap10100HdFd = 0x7800,
- MIIPreambleSupr = 0x0040,
- MIIAutoNegCompleted = 0x0020,
- MIIRemoteFault = 0x0010,
- MIICapAutoNeg = 0x0008,
- MIILink = 0x0004,
- MIIJabber = 0x0002,
- MIIExtended = 0x0001
-};
-
/* The Rx and Tx buffer descriptors. */
struct rx_desc {
s32 rx_status;
@@ -533,8 +519,6 @@ static void via_rhine_set_rx_mode(struct
static struct net_device_stats *via_rhine_get_stats(struct net_device *dev);
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int via_rhine_close(struct net_device *dev);
-static inline void clear_tally_counters(long ioaddr);
-static inline void via_restart_tx(struct net_device *dev);
static void wait_for_reset(struct net_device *dev, int chip_id, char *name)
{
@@ -797,7 +781,7 @@ static int __devinit via_rhine_init_one
mdio_read(dev, phy, 5));
/* set IFF_RUNNING */
- if (mii_status & MIILink)
+ if (mii_status & BMSR_LSTATUS)
netif_carrier_on(dev);
else
netif_carrier_off(dev);
@@ -1175,8 +1159,8 @@ static void via_rhine_timer(unsigned lon
/* make IFF_RUNNING follow the MII status bit "Link established" */
mii_status = mdio_read(dev, np->phys[0], MII_BMSR);
- if ( (mii_status & MIILink) != (np->mii_status & MIILink) ) {
- if (mii_status & MIILink)
+ if ( (mii_status & BMSR_LSTATUS) != (np->mii_status & BMSR_LSTATUS) ) {
+ if (mii_status & BMSR_LSTATUS)
netif_carrier_on(dev);
else
netif_carrier_off(dev);
@@ -1414,8 +1398,8 @@ static void via_rhine_rx(struct net_devi
int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
if (debug > 4) {
- printk(KERN_DEBUG " In via_rhine_rx(), entry %d status %8.8x.\n",
- entry, le32_to_cpu(np->rx_head_desc->rx_status));
+ printk(KERN_DEBUG "%s: via_rhine_rx(), entry %d status %8.8x.\n",
+ dev->name, entry, le32_to_cpu(np->rx_head_desc->rx_status));
}
/* If EOP is set on the next entry, it's a new packet. Send it up. */
@@ -1521,7 +1505,18 @@ static void via_rhine_rx(struct net_devi
writew(CmdRxDemand | np->chip_cmd, dev->base_addr + ChipCmd);
}
-static inline void via_restart_tx(struct net_device *dev) {
+/* Clears the "tally counters" for CRC errors and missed frames(?).
+ It has been reported that some chips need a write of 0 to clear
+ these, for others the counters are set to 1 when written to and
+ instead cleared when read. So we clear them both ways ... */
+static inline void clear_tally_counters(const long ioaddr)
+{
+ writel(0, ioaddr + RxMissed);
+ readw(ioaddr + RxCRCErrs);
+ readw(ioaddr + RxMissed);
+}
+
+static inline void via_rhine_restart_tx(struct net_device *dev) {
struct netdev_private *np = dev->priv;
int entry = np->dirty_tx % TX_RING_SIZE;
@@ -1561,7 +1556,7 @@ static void via_rhine_error(struct net_d
if (debug > 1)
printk(KERN_INFO "%s: Abort %4.4x, frame dropped.\n",
dev->name, intr_status);
- via_restart_tx(dev);
+ via_rhine_restart_tx(dev);
}
if (intr_status & IntrTxUnderrun) {
if (np->tx_thresh < 0xE0)
@@ -1570,7 +1565,7 @@ static void via_rhine_error(struct net_d
printk(KERN_INFO "%s: Transmitter underrun, Tx "
"threshold now %2.2x.\n",
dev->name, np->tx_thresh);
- via_restart_tx(dev);
+ via_rhine_restart_tx(dev);
}
if (intr_status & ~( IntrLinkChange | IntrStatsMax |
IntrTxError | IntrTxAborted | IntrNormalSummary)) {
@@ -1599,17 +1594,6 @@ static struct net_device_stats *via_rhin
return &np->stats;
}
-/* Clears the "tally counters" for CRC errors and missed frames(?).
- It has been reported that some chips need a write of 0 to clear
- these, for others the counters are set to 1 when written to and
- instead cleared when read. So we clear them both ways ... */
-static inline void clear_tally_counters(const long ioaddr)
-{
- writel(0, ioaddr + RxMissed);
- readw(ioaddr + RxCRCErrs);
- readw(ioaddr + RxMissed);
-}
-
static void via_rhine_set_rx_mode(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
next prev parent reply other threads:[~2003-02-15 11:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-15 11:17 [0/4][via-rhine] Improvements Roger Luethi
2003-02-15 11:18 ` Roger Luethi [this message]
2003-02-15 11:18 ` [2/4][via-rhine][PATCH] Fix broken Tx underrun handling Roger Luethi
2003-02-15 11:18 ` [3/4][via-rhine][PATCH] Various duplex related fixes Roger Luethi
2003-02-15 11:18 ` [4/4][via-rhine][PATCH] Reset function rewrite Roger Luethi
2003-02-15 19:08 ` [0/4][via-rhine] Improvements Jeff Garzik
2003-02-15 20:53 ` Roger Luethi
2003-02-15 21:49 ` Jeff Garzik
2003-02-15 22:52 ` Roger Luethi
2003-02-16 0:16 ` Linus Torvalds
2003-02-16 11:01 ` Roger Luethi
2003-02-17 18:44 ` Jeff Garzik
2003-02-15 21:40 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030215111812.GA11525@k3.hellgate.ch \
--to=rl@hellgate.ch \
--cc=akpm@digeo.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox