aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/mdio_10g.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-06-23 07:30:07 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-25 01:13:22 -0400
commit62776d034cc40c49bafdb3551a6ba35f78e3f08d (patch)
tree1cd2132940ced266ad53619a0c947e153cc83a5e /drivers/net/sfc/mdio_10g.c
parent0c605a2061670412d3b5580c92f1e161b1a693d2 (diff)
sfc: Implement message level control
Replace EFX_ERR() with netif_err(), EFX_INFO() with netif_info(), EFX_LOG() with netif_dbg() and EFX_TRACE() and EFX_REGDUMP() with netif_vdbg(). Replace EFX_ERR_RL(), EFX_INFO_RL() and EFX_LOG_RL() using explicit calls to net_ratelimit(). Implement the ethtool operations to get and set message level flags, and add a 'debug' module parameter for the initial value. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/mdio_10g.c')
-rw-r--r--drivers/net/sfc/mdio_10g.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index 0548fcbbdcd0..eeaf0bd64bd3 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -63,7 +63,8 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
63 /* Read MMD STATUS2 to check it is responding. */ 63 /* Read MMD STATUS2 to check it is responding. */
64 status = efx_mdio_read(efx, mmd, MDIO_STAT2); 64 status = efx_mdio_read(efx, mmd, MDIO_STAT2);
65 if ((status & MDIO_STAT2_DEVPRST) != MDIO_STAT2_DEVPRST_VAL) { 65 if ((status & MDIO_STAT2_DEVPRST) != MDIO_STAT2_DEVPRST_VAL) {
66 EFX_ERR(efx, "PHY MMD %d not responding.\n", mmd); 66 netif_err(efx, hw, efx->net_dev,
67 "PHY MMD %d not responding.\n", mmd);
67 return -EIO; 68 return -EIO;
68 } 69 }
69 } 70 }
@@ -72,12 +73,14 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
72 status = efx_mdio_read(efx, mmd, MDIO_STAT1); 73 status = efx_mdio_read(efx, mmd, MDIO_STAT1);
73 if (status & MDIO_STAT1_FAULT) { 74 if (status & MDIO_STAT1_FAULT) {
74 if (fault_fatal) { 75 if (fault_fatal) {
75 EFX_ERR(efx, "PHY MMD %d reporting fatal" 76 netif_err(efx, hw, efx->net_dev,
76 " fault: status %x\n", mmd, status); 77 "PHY MMD %d reporting fatal"
78 " fault: status %x\n", mmd, status);
77 return -EIO; 79 return -EIO;
78 } else { 80 } else {
79 EFX_LOG(efx, "PHY MMD %d reporting status" 81 netif_dbg(efx, hw, efx->net_dev,
80 " %x (expected)\n", mmd, status); 82 "PHY MMD %d reporting status"
83 " %x (expected)\n", mmd, status);
81 } 84 }
82 } 85 }
83 return 0; 86 return 0;
@@ -103,8 +106,9 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask)
103 if (mask & 1) { 106 if (mask & 1) {
104 stat = efx_mdio_read(efx, mmd, MDIO_CTRL1); 107 stat = efx_mdio_read(efx, mmd, MDIO_CTRL1);
105 if (stat < 0) { 108 if (stat < 0) {
106 EFX_ERR(efx, "failed to read status of" 109 netif_err(efx, hw, efx->net_dev,
107 " MMD %d\n", mmd); 110 "failed to read status of"
111 " MMD %d\n", mmd);
108 return -EIO; 112 return -EIO;
109 } 113 }
110 if (stat & MDIO_CTRL1_RESET) 114 if (stat & MDIO_CTRL1_RESET)
@@ -119,8 +123,9 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask)
119 msleep(spintime); 123 msleep(spintime);
120 } 124 }
121 if (in_reset != 0) { 125 if (in_reset != 0) {
122 EFX_ERR(efx, "not all MMDs came out of reset in time." 126 netif_err(efx, hw, efx->net_dev,
123 " MMDs still in reset: %x\n", in_reset); 127 "not all MMDs came out of reset in time."
128 " MMDs still in reset: %x\n", in_reset);
124 rc = -ETIMEDOUT; 129 rc = -ETIMEDOUT;
125 } 130 }
126 return rc; 131 return rc;
@@ -142,16 +147,18 @@ int efx_mdio_check_mmds(struct efx_nic *efx,
142 devs1 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS1); 147 devs1 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS1);
143 devs2 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS2); 148 devs2 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS2);
144 if (devs1 < 0 || devs2 < 0) { 149 if (devs1 < 0 || devs2 < 0) {
145 EFX_ERR(efx, "failed to read devices present\n"); 150 netif_err(efx, hw, efx->net_dev,
151 "failed to read devices present\n");
146 return -EIO; 152 return -EIO;
147 } 153 }
148 devices = devs1 | (devs2 << 16); 154 devices = devs1 | (devs2 << 16);
149 if ((devices & mmd_mask) != mmd_mask) { 155 if ((devices & mmd_mask) != mmd_mask) {
150 EFX_ERR(efx, "required MMDs not present: got %x, " 156 netif_err(efx, hw, efx->net_dev,
151 "wanted %x\n", devices, mmd_mask); 157 "required MMDs not present: got %x, wanted %x\n",
158 devices, mmd_mask);
152 return -ENODEV; 159 return -ENODEV;
153 } 160 }
154 EFX_TRACE(efx, "Devices present: %x\n", devices); 161 netif_vdbg(efx, hw, efx->net_dev, "Devices present: %x\n", devices);
155 162
156 /* Check all required MMDs are responding and happy. */ 163 /* Check all required MMDs are responding and happy. */
157 while (mmd_mask) { 164 while (mmd_mask) {
@@ -219,7 +226,7 @@ static void efx_mdio_set_mmd_lpower(struct efx_nic *efx,
219{ 226{
220 int stat = efx_mdio_read(efx, mmd, MDIO_STAT1); 227 int stat = efx_mdio_read(efx, mmd, MDIO_STAT1);
221 228
222 EFX_TRACE(efx, "Setting low power mode for MMD %d to %d\n", 229 netif_vdbg(efx, drv, efx->net_dev, "Setting low power mode for MMD %d to %d\n",
223 mmd, lpower); 230 mmd, lpower);
224 231
225 if (stat & MDIO_STAT1_LPOWERABLE) { 232 if (stat & MDIO_STAT1_LPOWERABLE) {
@@ -349,8 +356,8 @@ int efx_mdio_test_alive(struct efx_nic *efx)
349 356
350 if ((physid1 == 0x0000) || (physid1 == 0xffff) || 357 if ((physid1 == 0x0000) || (physid1 == 0xffff) ||
351 (physid2 == 0x0000) || (physid2 == 0xffff)) { 358 (physid2 == 0x0000) || (physid2 == 0xffff)) {
352 EFX_ERR(efx, "no MDIO PHY present with ID %d\n", 359 netif_err(efx, hw, efx->net_dev,
353 efx->mdio.prtad); 360 "no MDIO PHY present with ID %d\n", efx->mdio.prtad);
354 rc = -EINVAL; 361 rc = -EINVAL;
355 } else { 362 } else {
356 rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0); 363 rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0);