aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-23 11:08:17 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-24 13:59:04 -0500
commitc459302db655c1a7fd05fd4266b18990854e8386 (patch)
tree94adde79f8c3a5a447305cf425a5caa1c7091df7 /drivers/net/sfc
parentf5e7adc3d4aa8edab63bb63f0ce5fe92c3dd7604 (diff)
sfc: Log interrupt and reset type names, not numbers
Define name tables for these enumerations in a similar way as for loopback. Move the loopback name table together with them. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/efx.c51
-rw-r--r--drivers/net/sfc/enum.h6
-rw-r--r--drivers/net/sfc/ethtool.c15
-rw-r--r--drivers/net/sfc/falcon.c2
-rw-r--r--drivers/net/sfc/net_driver.h19
-rw-r--r--drivers/net/sfc/selftest.c4
6 files changed, 69 insertions, 28 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index cb7899532659..4787faaf30c1 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -25,6 +25,50 @@
25#include "mdio_10g.h" 25#include "mdio_10g.h"
26#include "falcon.h" 26#include "falcon.h"
27 27
28/**************************************************************************
29 *
30 * Type name strings
31 *
32 **************************************************************************
33 */
34
35/* Loopback mode names (see LOOPBACK_MODE()) */
36const unsigned int efx_loopback_mode_max = LOOPBACK_MAX;
37const char *efx_loopback_mode_names[] = {
38 [LOOPBACK_NONE] = "NONE",
39 [LOOPBACK_GMAC] = "GMAC",
40 [LOOPBACK_XGMII] = "XGMII",
41 [LOOPBACK_XGXS] = "XGXS",
42 [LOOPBACK_XAUI] = "XAUI",
43 [LOOPBACK_GPHY] = "GPHY",
44 [LOOPBACK_PHYXS] = "PHYXS",
45 [LOOPBACK_PCS] = "PCS",
46 [LOOPBACK_PMAPMD] = "PMA/PMD",
47 [LOOPBACK_NETWORK] = "NETWORK",
48};
49
50/* Interrupt mode names (see INT_MODE())) */
51const unsigned int efx_interrupt_mode_max = EFX_INT_MODE_MAX;
52const char *efx_interrupt_mode_names[] = {
53 [EFX_INT_MODE_MSIX] = "MSI-X",
54 [EFX_INT_MODE_MSI] = "MSI",
55 [EFX_INT_MODE_LEGACY] = "legacy",
56};
57
58const unsigned int efx_reset_type_max = RESET_TYPE_MAX;
59const char *efx_reset_type_names[] = {
60 [RESET_TYPE_INVISIBLE] = "INVISIBLE",
61 [RESET_TYPE_ALL] = "ALL",
62 [RESET_TYPE_WORLD] = "WORLD",
63 [RESET_TYPE_DISABLE] = "DISABLE",
64 [RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG",
65 [RESET_TYPE_INT_ERROR] = "INT_ERROR",
66 [RESET_TYPE_RX_RECOVERY] = "RX_RECOVERY",
67 [RESET_TYPE_RX_DESC_FETCH] = "RX_DESC_FETCH",
68 [RESET_TYPE_TX_DESC_FETCH] = "TX_DESC_FETCH",
69 [RESET_TYPE_TX_SKIP] = "TX_SKIP",
70};
71
28#define EFX_MAX_MTU (9 * 1024) 72#define EFX_MAX_MTU (9 * 1024)
29 73
30/* RX slow fill workqueue. If memory allocation fails in the fast path, 74/* RX slow fill workqueue. If memory allocation fails in the fast path,
@@ -1772,7 +1816,7 @@ static int efx_reset(struct efx_nic *efx)
1772 goto out_unlock; 1816 goto out_unlock;
1773 } 1817 }
1774 1818
1775 EFX_INFO(efx, "resetting (%d)\n", method); 1819 EFX_INFO(efx, "resetting (%s)\n", RESET_TYPE(method));
1776 1820
1777 efx_reset_down(efx, method, &ecmd); 1821 efx_reset_down(efx, method, &ecmd);
1778 1822
@@ -1851,9 +1895,10 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type)
1851 } 1895 }
1852 1896
1853 if (method != type) 1897 if (method != type)
1854 EFX_LOG(efx, "scheduling reset (%d:%d)\n", type, method); 1898 EFX_LOG(efx, "scheduling %s reset for %s\n",
1899 RESET_TYPE(method), RESET_TYPE(type));
1855 else 1900 else
1856 EFX_LOG(efx, "scheduling reset (%d)\n", method); 1901 EFX_LOG(efx, "scheduling %s reset\n", RESET_TYPE(method));
1857 1902
1858 efx->reset_pending = method; 1903 efx->reset_pending = method;
1859 1904
diff --git a/drivers/net/sfc/enum.h b/drivers/net/sfc/enum.h
index 60cbc6e1e66b..fcd14b73f24d 100644
--- a/drivers/net/sfc/enum.h
+++ b/drivers/net/sfc/enum.h
@@ -40,12 +40,6 @@ enum efx_loopback_mode {
40 40
41#define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD 41#define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD
42 42
43extern const char *efx_loopback_mode_names[];
44#define LOOPBACK_MODE_NAME(mode) \
45 STRING_TABLE_LOOKUP(mode, efx_loopback_mode)
46#define LOOPBACK_MODE(efx) \
47 LOOPBACK_MODE_NAME(efx->loopback_mode)
48
49/* These loopbacks occur within the controller */ 43/* These loopbacks occur within the controller */
50#define LOOPBACKS_INTERNAL ((1 << LOOPBACK_GMAC) | \ 44#define LOOPBACKS_INTERNAL ((1 << LOOPBACK_GMAC) | \
51 (1 << LOOPBACK_XGMII)| \ 45 (1 << LOOPBACK_XGMII)| \
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index e8afd784e6b2..d8915b95e65a 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -20,19 +20,6 @@
20#include "spi.h" 20#include "spi.h"
21#include "mdio_10g.h" 21#include "mdio_10g.h"
22 22
23const char *efx_loopback_mode_names[] = {
24 [LOOPBACK_NONE] = "NONE",
25 [LOOPBACK_GMAC] = "GMAC",
26 [LOOPBACK_XGMII] = "XGMII",
27 [LOOPBACK_XGXS] = "XGXS",
28 [LOOPBACK_XAUI] = "XAUI",
29 [LOOPBACK_GPHY] = "GPHY",
30 [LOOPBACK_PHYXS] = "PHYXS",
31 [LOOPBACK_PCS] = "PCS",
32 [LOOPBACK_PMAPMD] = "PMA/PMD",
33 [LOOPBACK_NETWORK] = "NETWORK",
34};
35
36struct ethtool_string { 23struct ethtool_string {
37 char name[ETH_GSTRING_LEN]; 24 char name[ETH_GSTRING_LEN];
38}; 25};
@@ -290,7 +277,7 @@ static void efx_fill_test(unsigned int test_index,
290#define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->queue 277#define EFX_TX_QUEUE_NAME(_tx_queue) "txq%d", _tx_queue->queue
291#define EFX_RX_QUEUE_NAME(_rx_queue) "rxq%d", _rx_queue->queue 278#define EFX_RX_QUEUE_NAME(_rx_queue) "rxq%d", _rx_queue->queue
292#define EFX_LOOPBACK_NAME(_mode, _counter) \ 279#define EFX_LOOPBACK_NAME(_mode, _counter) \
293 "loopback.%s." _counter, LOOPBACK_MODE_NAME(mode) 280 "loopback.%s." _counter, STRING_TABLE_LOOKUP(_mode, efx_loopback_mode)
294 281
295/** 282/**
296 * efx_fill_loopback_test - fill in a block of loopback self-test entries 283 * efx_fill_loopback_test - fill in a block of loopback self-test entries
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 6eee4b796c43..41a321b0e8c6 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -2485,7 +2485,7 @@ int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
2485 efx_oword_t glb_ctl_reg_ker; 2485 efx_oword_t glb_ctl_reg_ker;
2486 int rc; 2486 int rc;
2487 2487
2488 EFX_LOG(efx, "performing hardware reset (%d)\n", method); 2488 EFX_LOG(efx, "performing %s hardware reset\n", RESET_TYPE(method));
2489 2489
2490 /* Initiate device reset */ 2490 /* Initiate device reset */
2491 if (method == RESET_TYPE_WORLD) { 2491 if (method == RESET_TYPE_WORLD) {
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index f2df32423c98..ac808d5f24a0 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -394,8 +394,23 @@ enum efx_led_mode {
394 EFX_LED_DEFAULT = 2 394 EFX_LED_DEFAULT = 2
395}; 395};
396 396
397#define STRING_TABLE_LOOKUP(val, member) \ 397#define STRING_TABLE_LOOKUP(val, member) \
398 member ## _names[val] 398 ((val) < member ## _max) ? member ## _names[val] : "(invalid)"
399
400extern const char *efx_loopback_mode_names[];
401extern const unsigned int efx_loopback_mode_max;
402#define LOOPBACK_MODE(efx) \
403 STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_loopback_mode)
404
405extern const char *efx_interrupt_mode_names[];
406extern const unsigned int efx_interrupt_mode_max;
407#define INT_MODE(efx) \
408 STRING_TABLE_LOOKUP(efx->interrupt_mode, efx_interrupt_mode)
409
410extern const char *efx_reset_type_names[];
411extern const unsigned int efx_reset_type_max;
412#define RESET_TYPE(type) \
413 STRING_TABLE_LOOKUP(type, efx_reset_type)
399 414
400enum efx_int_mode { 415enum efx_int_mode {
401 /* Be careful if altering to correct macro below */ 416 /* Be careful if altering to correct macro below */
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index afac1cc6bd2f..63ff295334e4 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -175,8 +175,8 @@ static int efx_test_interrupts(struct efx_nic *efx,
175 return -ETIMEDOUT; 175 return -ETIMEDOUT;
176 176
177 success: 177 success:
178 EFX_LOG(efx, "test interrupt (mode %d) seen on CPU%d\n", 178 EFX_LOG(efx, "%s test interrupt seen on CPU%d\n", INT_MODE(efx),
179 efx->interrupt_mode, efx->last_irq_cpu); 179 efx->last_irq_cpu);
180 tests->interrupt = 1; 180 tests->interrupt = 1;
181 return 0; 181 return 0;
182} 182}