diff options
author | Steve Glendinning <steve.glendinning@smsc.com> | 2009-03-18 20:24:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-20 02:59:27 -0400 |
commit | 785b6f977a89aaabc3dd3e3bfc87f36015cb8050 (patch) | |
tree | 8d73ee27ca093bcfab839b31a3e9990ada3570d9 /drivers | |
parent | 2e1ab634bf013792d8803ec57c7a428a76f50028 (diff) |
smsc911x: define status word positions as constants
The vast majority of bit constants in this driver are defined in the
header file, but TX and RX status word bits are not. This patch (which
should make no functional change) defines these, to make the driver
slightly more readable.
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smsc911x.c | 18 | ||||
-rw-r--r-- | drivers/net/smsc911x.h | 7 |
2 files changed, 15 insertions, 10 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index ad15aab2137d..0232292bd170 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -895,22 +895,22 @@ static void smsc911x_tx_update_txcounters(struct net_device *dev) | |||
895 | SMSC_WARNING(HW, | 895 | SMSC_WARNING(HW, |
896 | "Packet tag reserved bit is high"); | 896 | "Packet tag reserved bit is high"); |
897 | } else { | 897 | } else { |
898 | if (unlikely(tx_stat & 0x00008000)) { | 898 | if (unlikely(tx_stat & TX_STS_ES_)) { |
899 | dev->stats.tx_errors++; | 899 | dev->stats.tx_errors++; |
900 | } else { | 900 | } else { |
901 | dev->stats.tx_packets++; | 901 | dev->stats.tx_packets++; |
902 | dev->stats.tx_bytes += (tx_stat >> 16); | 902 | dev->stats.tx_bytes += (tx_stat >> 16); |
903 | } | 903 | } |
904 | if (unlikely(tx_stat & 0x00000100)) { | 904 | if (unlikely(tx_stat & TX_STS_EXCESS_COL_)) { |
905 | dev->stats.collisions += 16; | 905 | dev->stats.collisions += 16; |
906 | dev->stats.tx_aborted_errors += 1; | 906 | dev->stats.tx_aborted_errors += 1; |
907 | } else { | 907 | } else { |
908 | dev->stats.collisions += | 908 | dev->stats.collisions += |
909 | ((tx_stat >> 3) & 0xF); | 909 | ((tx_stat >> 3) & 0xF); |
910 | } | 910 | } |
911 | if (unlikely(tx_stat & 0x00000800)) | 911 | if (unlikely(tx_stat & TX_STS_LOST_CARRIER_)) |
912 | dev->stats.tx_carrier_errors += 1; | 912 | dev->stats.tx_carrier_errors += 1; |
913 | if (unlikely(tx_stat & 0x00000200)) { | 913 | if (unlikely(tx_stat & TX_STS_LATE_COL_)) { |
914 | dev->stats.collisions++; | 914 | dev->stats.collisions++; |
915 | dev->stats.tx_aborted_errors++; | 915 | dev->stats.tx_aborted_errors++; |
916 | } | 916 | } |
@@ -924,19 +924,17 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat) | |||
924 | { | 924 | { |
925 | int crc_err = 0; | 925 | int crc_err = 0; |
926 | 926 | ||
927 | if (unlikely(rxstat & 0x00008000)) { | 927 | if (unlikely(rxstat & RX_STS_ES_)) { |
928 | dev->stats.rx_errors++; | 928 | dev->stats.rx_errors++; |
929 | if (unlikely(rxstat & 0x00000002)) { | 929 | if (unlikely(rxstat & RX_STS_CRC_ERR_)) { |
930 | dev->stats.rx_crc_errors++; | 930 | dev->stats.rx_crc_errors++; |
931 | crc_err = 1; | 931 | crc_err = 1; |
932 | } | 932 | } |
933 | } | 933 | } |
934 | if (likely(!crc_err)) { | 934 | if (likely(!crc_err)) { |
935 | if (unlikely((rxstat & 0x00001020) == 0x00001020)) { | 935 | if (unlikely((rxstat & RX_STS_FRAME_TYPE_) && |
936 | /* Frame type indicates length, | 936 | (rxstat & RX_STS_LENGTH_ERR_))) |
937 | * and length error is set */ | ||
938 | dev->stats.rx_length_errors++; | 937 | dev->stats.rx_length_errors++; |
939 | } | ||
940 | if (rxstat & RX_STS_MCAST_) | 938 | if (rxstat & RX_STS_MCAST_) |
941 | dev->stats.multicast++; | 939 | dev->stats.multicast++; |
942 | } | 940 | } |
diff --git a/drivers/net/smsc911x.h b/drivers/net/smsc911x.h index 2b76654bb958..b5716bd8a597 100644 --- a/drivers/net/smsc911x.h +++ b/drivers/net/smsc911x.h | |||
@@ -81,12 +81,19 @@ | |||
81 | 81 | ||
82 | #define RX_STATUS_FIFO 0x40 | 82 | #define RX_STATUS_FIFO 0x40 |
83 | #define RX_STS_ES_ 0x00008000 | 83 | #define RX_STS_ES_ 0x00008000 |
84 | #define RX_STS_LENGTH_ERR_ 0x00001000 | ||
84 | #define RX_STS_MCAST_ 0x00000400 | 85 | #define RX_STS_MCAST_ 0x00000400 |
86 | #define RX_STS_FRAME_TYPE_ 0x00000020 | ||
87 | #define RX_STS_CRC_ERR_ 0x00000002 | ||
85 | 88 | ||
86 | #define RX_STATUS_FIFO_PEEK 0x44 | 89 | #define RX_STATUS_FIFO_PEEK 0x44 |
87 | 90 | ||
88 | #define TX_STATUS_FIFO 0x48 | 91 | #define TX_STATUS_FIFO 0x48 |
89 | #define TX_STS_ES_ 0x00008000 | 92 | #define TX_STS_ES_ 0x00008000 |
93 | #define TX_STS_LOST_CARRIER_ 0x00000800 | ||
94 | #define TX_STS_NO_CARRIER_ 0x00000400 | ||
95 | #define TX_STS_LATE_COL_ 0x00000200 | ||
96 | #define TX_STS_EXCESS_COL_ 0x00000100 | ||
90 | 97 | ||
91 | #define TX_STATUS_FIFO_PEEK 0x4C | 98 | #define TX_STATUS_FIFO_PEEK 0x4C |
92 | 99 | ||