diff options
author | Michael Chan <mchan@broadcom.com> | 2005-05-29 17:56:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-05-29 17:56:34 -0400 |
commit | 4cafd3f533475c976879d85773735c004f09f576 (patch) | |
tree | b72e4f1f5a5272b473c70138f3f76ec3406f08f4 /drivers/net/tg3.c | |
parent | 7ce54e3f428b33af714271140601c87b8bf2c544 (diff) |
[TG3]: Add basic selftest infrastructure
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f10dd74988c4..088ed9f634e5 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -133,6 +133,8 @@ | |||
133 | /* number of ETHTOOL_GSTATS u64's */ | 133 | /* number of ETHTOOL_GSTATS u64's */ |
134 | #define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64)) | 134 | #define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64)) |
135 | 135 | ||
136 | #define TG3_NUM_TEST 6 | ||
137 | |||
136 | static char version[] __devinitdata = | 138 | static char version[] __devinitdata = |
137 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 139 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
138 | 140 | ||
@@ -316,6 +318,17 @@ static struct { | |||
316 | { "nic_tx_threshold_hit" } | 318 | { "nic_tx_threshold_hit" } |
317 | }; | 319 | }; |
318 | 320 | ||
321 | static struct { | ||
322 | const char string[ETH_GSTRING_LEN]; | ||
323 | } ethtool_test_keys[TG3_NUM_TEST] = { | ||
324 | { "nvram test (online) " }, | ||
325 | { "link test (online) " }, | ||
326 | { "register test (offline)" }, | ||
327 | { "memory test (offline)" }, | ||
328 | { "loopback test (offline)" }, | ||
329 | { "interrupt test (offline)" }, | ||
330 | }; | ||
331 | |||
319 | static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) | 332 | static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) |
320 | { | 333 | { |
321 | if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { | 334 | if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0) { |
@@ -7199,12 +7212,20 @@ static int tg3_get_stats_count (struct net_device *dev) | |||
7199 | return TG3_NUM_STATS; | 7212 | return TG3_NUM_STATS; |
7200 | } | 7213 | } |
7201 | 7214 | ||
7215 | static int tg3_get_test_count (struct net_device *dev) | ||
7216 | { | ||
7217 | return TG3_NUM_TEST; | ||
7218 | } | ||
7219 | |||
7202 | static void tg3_get_strings (struct net_device *dev, u32 stringset, u8 *buf) | 7220 | static void tg3_get_strings (struct net_device *dev, u32 stringset, u8 *buf) |
7203 | { | 7221 | { |
7204 | switch (stringset) { | 7222 | switch (stringset) { |
7205 | case ETH_SS_STATS: | 7223 | case ETH_SS_STATS: |
7206 | memcpy(buf, ðtool_stats_keys, sizeof(ethtool_stats_keys)); | 7224 | memcpy(buf, ðtool_stats_keys, sizeof(ethtool_stats_keys)); |
7207 | break; | 7225 | break; |
7226 | case ETH_SS_TEST: | ||
7227 | memcpy(buf, ðtool_test_keys, sizeof(ethtool_test_keys)); | ||
7228 | break; | ||
7208 | default: | 7229 | default: |
7209 | WARN_ON(1); /* we need a WARN() */ | 7230 | WARN_ON(1); /* we need a WARN() */ |
7210 | break; | 7231 | break; |
@@ -7218,6 +7239,11 @@ static void tg3_get_ethtool_stats (struct net_device *dev, | |||
7218 | memcpy(tmp_stats, tg3_get_estats(tp), sizeof(tp->estats)); | 7239 | memcpy(tmp_stats, tg3_get_estats(tp), sizeof(tp->estats)); |
7219 | } | 7240 | } |
7220 | 7241 | ||
7242 | static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, | ||
7243 | u64 *data) | ||
7244 | { | ||
7245 | } | ||
7246 | |||
7221 | static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 7247 | static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
7222 | { | 7248 | { |
7223 | struct mii_ioctl_data *data = if_mii(ifr); | 7249 | struct mii_ioctl_data *data = if_mii(ifr); |
@@ -7331,6 +7357,8 @@ static struct ethtool_ops tg3_ethtool_ops = { | |||
7331 | .get_tso = ethtool_op_get_tso, | 7357 | .get_tso = ethtool_op_get_tso, |
7332 | .set_tso = tg3_set_tso, | 7358 | .set_tso = tg3_set_tso, |
7333 | #endif | 7359 | #endif |
7360 | .self_test_count = tg3_get_test_count, | ||
7361 | .self_test = tg3_self_test, | ||
7334 | .get_strings = tg3_get_strings, | 7362 | .get_strings = tg3_get_strings, |
7335 | .get_stats_count = tg3_get_stats_count, | 7363 | .get_stats_count = tg3_get_stats_count, |
7336 | .get_ethtool_stats = tg3_get_ethtool_stats, | 7364 | .get_ethtool_stats = tg3_get_ethtool_stats, |