Commit 62776d03 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

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: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0c605a20
This diff is collapsed.
...@@ -106,8 +106,9 @@ extern unsigned int efx_monitor_interval; ...@@ -106,8 +106,9 @@ extern unsigned int efx_monitor_interval;
static inline void efx_schedule_channel(struct efx_channel *channel) static inline void efx_schedule_channel(struct efx_channel *channel)
{ {
EFX_TRACE(channel->efx, "channel %d scheduling NAPI poll on CPU%d\n", netif_vdbg(channel->efx, intr, channel->efx->net_dev,
channel->channel, raw_smp_processor_id()); "channel %d scheduling NAPI poll on CPU%d\n",
channel->channel, raw_smp_processor_id());
channel->work_pending = true; channel->work_pending = true;
napi_schedule(&channel->napi_str); napi_schedule(&channel->napi_str);
......
...@@ -218,8 +218,8 @@ int efx_ethtool_set_settings(struct net_device *net_dev, ...@@ -218,8 +218,8 @@ int efx_ethtool_set_settings(struct net_device *net_dev,
/* GMAC does not support 1000Mbps HD */ /* GMAC does not support 1000Mbps HD */
if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) { if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) {
EFX_LOG(efx, "rejecting unsupported 1000Mbps HD" netif_dbg(efx, drv, efx->net_dev,
" setting\n"); "rejecting unsupported 1000Mbps HD setting\n");
return -EINVAL; return -EINVAL;
} }
...@@ -256,6 +256,18 @@ static void efx_ethtool_get_regs(struct net_device *net_dev, ...@@ -256,6 +256,18 @@ static void efx_ethtool_get_regs(struct net_device *net_dev,
efx_nic_get_regs(efx, buf); efx_nic_get_regs(efx, buf);
} }
static u32 efx_ethtool_get_msglevel(struct net_device *net_dev)
{
struct efx_nic *efx = netdev_priv(net_dev);
return efx->msg_enable;
}
static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable)
{
struct efx_nic *efx = netdev_priv(net_dev);
efx->msg_enable = msg_enable;
}
/** /**
* efx_fill_test - fill in an individual self-test entry * efx_fill_test - fill in an individual self-test entry
* @test_index: Index of the test * @test_index: Index of the test
...@@ -553,7 +565,8 @@ static void efx_ethtool_self_test(struct net_device *net_dev, ...@@ -553,7 +565,8 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
if (!already_up) { if (!already_up) {
rc = dev_open(efx->net_dev); rc = dev_open(efx->net_dev);
if (rc) { if (rc) {
EFX_ERR(efx, "failed opening device.\n"); netif_err(efx, drv, efx->net_dev,
"failed opening device.\n");
goto fail2; goto fail2;
} }
} }
...@@ -565,9 +578,9 @@ static void efx_ethtool_self_test(struct net_device *net_dev, ...@@ -565,9 +578,9 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
if (!already_up) if (!already_up)
dev_close(efx->net_dev); dev_close(efx->net_dev);
EFX_LOG(efx, "%s %sline self-tests\n", netif_dbg(efx, drv, efx->net_dev, "%s %sline self-tests\n",
rc == 0 ? "passed" : "failed", rc == 0 ? "passed" : "failed",
(test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
fail2: fail2:
fail1: fail1:
...@@ -693,8 +706,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, ...@@ -693,8 +706,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (coalesce->rx_coalesce_usecs || coalesce->tx_coalesce_usecs) { if (coalesce->rx_coalesce_usecs || coalesce->tx_coalesce_usecs) {
EFX_ERR(efx, "invalid coalescing setting. " netif_err(efx, drv, efx->net_dev, "invalid coalescing setting. "
"Only rx/tx_coalesce_usecs_irq are supported\n"); "Only rx/tx_coalesce_usecs_irq are supported\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -706,8 +719,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, ...@@ -706,8 +719,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev,
efx_for_each_tx_queue(tx_queue, efx) { efx_for_each_tx_queue(tx_queue, efx) {
if ((tx_queue->channel->channel < efx->n_rx_channels) && if ((tx_queue->channel->channel < efx->n_rx_channels) &&
tx_usecs) { tx_usecs) {
EFX_ERR(efx, "Channel is shared. " netif_err(efx, drv, efx->net_dev, "Channel is shared. "
"Only RX coalescing may be set\n"); "Only RX coalescing may be set\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
} }
...@@ -735,13 +748,15 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, ...@@ -735,13 +748,15 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
(pause->autoneg ? EFX_FC_AUTO : 0)); (pause->autoneg ? EFX_FC_AUTO : 0));
if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) { if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) {
EFX_LOG(efx, "Flow control unsupported: tx ON rx OFF\n"); netif_dbg(efx, drv, efx->net_dev,
"Flow control unsupported: tx ON rx OFF\n");
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising) { if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising) {
EFX_LOG(efx, "Autonegotiation is disabled\n"); netif_dbg(efx, drv, efx->net_dev,
"Autonegotiation is disabled\n");
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
...@@ -772,8 +787,9 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, ...@@ -772,8 +787,9 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
(efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) {
rc = efx->phy_op->reconfigure(efx); rc = efx->phy_op->reconfigure(efx);
if (rc) { if (rc) {
EFX_ERR(efx, "Unable to advertise requested flow " netif_err(efx, drv, efx->net_dev,
"control setting\n"); "Unable to advertise requested flow "
"control setting\n");
goto out; goto out;
} }
} }
...@@ -850,6 +866,8 @@ const struct ethtool_ops efx_ethtool_ops = { ...@@ -850,6 +866,8 @@ const struct ethtool_ops efx_ethtool_ops = {
.get_drvinfo = efx_ethtool_get_drvinfo, .get_drvinfo = efx_ethtool_get_drvinfo,
.get_regs_len = efx_ethtool_get_regs_len, .get_regs_len = efx_ethtool_get_regs_len,
.get_regs = efx_ethtool_get_regs, .get_regs = efx_ethtool_get_regs,
.get_msglevel = efx_ethtool_get_msglevel,
.set_msglevel = efx_ethtool_set_msglevel,
.nway_reset = efx_ethtool_nway_reset, .nway_reset = efx_ethtool_nway_reset,
.get_link = efx_ethtool_get_link, .get_link = efx_ethtool_get_link,
.get_eeprom_len = efx_ethtool_get_eeprom_len, .get_eeprom_len = efx_ethtool_get_eeprom_len,
......
This diff is collapsed.
...@@ -106,12 +106,12 @@ static int efx_check_lm87(struct efx_nic *efx, unsigned mask) ...@@ -106,12 +106,12 @@ static int efx_check_lm87(struct efx_nic *efx, unsigned mask)
alarms1 &= mask; alarms1 &= mask;
alarms2 &= mask >> 8; alarms2 &= mask >> 8;
if (alarms1 || alarms2) { if (alarms1 || alarms2) {
EFX_ERR(efx, netif_err(efx, hw, efx->net_dev,
"LM87 detected a hardware failure (status %02x:%02x)" "LM87 detected a hardware failure (status %02x:%02x)"
"%s%s\n", "%s%s\n",
alarms1, alarms2, alarms1, alarms2,
(alarms1 & LM87_ALARM_TEMP_INT) ? " INTERNAL" : "", (alarms1 & LM87_ALARM_TEMP_INT) ? " INTERNAL" : "",
(alarms1 & LM87_ALARM_TEMP_EXT1) ? " EXTERNAL" : ""); (alarms1 & LM87_ALARM_TEMP_EXT1) ? " EXTERNAL" : "");
return -ERANGE; return -ERANGE;
} }
...@@ -243,7 +243,7 @@ static int sfe4001_poweron(struct efx_nic *efx) ...@@ -243,7 +243,7 @@ static int sfe4001_poweron(struct efx_nic *efx)
(0 << P0_EN_3V3X_LBN) | (0 << P0_EN_5V_LBN) | (0 << P0_EN_3V3X_LBN) | (0 << P0_EN_5V_LBN) |
(0 << P0_EN_1V0X_LBN)); (0 << P0_EN_1V0X_LBN));
if (rc != out) { if (rc != out) {
EFX_INFO(efx, "power-cycling PHY\n"); netif_info(efx, hw, efx->net_dev, "power-cycling PHY\n");
rc = i2c_smbus_write_byte_data(ioexp_client, P0_OUT, out); rc = i2c_smbus_write_byte_data(ioexp_client, P0_OUT, out);
if (rc) if (rc)
goto fail_on; goto fail_on;
...@@ -269,7 +269,8 @@ static int sfe4001_poweron(struct efx_nic *efx) ...@@ -269,7 +269,8 @@ static int sfe4001_poweron(struct efx_nic *efx)
if (rc) if (rc)
goto fail_on; goto fail_on;
EFX_INFO(efx, "waiting for DSP boot (attempt %d)...\n", i); netif_info(efx, hw, efx->net_dev,
"waiting for DSP boot (attempt %d)...\n", i);
/* In flash config mode, DSP does not turn on AFE, so /* In flash config mode, DSP does not turn on AFE, so
* just wait 1 second. * just wait 1 second.
...@@ -291,7 +292,7 @@ static int sfe4001_poweron(struct efx_nic *efx) ...@@ -291,7 +292,7 @@ static int sfe4001_poweron(struct efx_nic *efx)
} }
} }
EFX_INFO(efx, "timed out waiting for DSP boot\n"); netif_info(efx, hw, efx->net_dev, "timed out waiting for DSP boot\n");
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
fail_on: fail_on:
sfe4001_poweroff(efx); sfe4001_poweroff(efx);
...@@ -377,7 +378,7 @@ static void sfe4001_fini(struct efx_nic *efx) ...@@ -377,7 +378,7 @@ static void sfe4001_fini(struct efx_nic *efx)
{ {
struct falcon_board *board = falcon_board(efx); struct falcon_board *board = falcon_board(efx);
EFX_INFO(efx, "%s\n", __func__); netif_info(efx, drv, efx->net_dev, "%s\n", __func__);
device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
sfe4001_poweroff(efx); sfe4001_poweroff(efx);
...@@ -461,7 +462,7 @@ static int sfe4001_init(struct efx_nic *efx) ...@@ -461,7 +462,7 @@ static int sfe4001_init(struct efx_nic *efx)
if (rc) if (rc)
goto fail_on; goto fail_on;
EFX_INFO(efx, "PHY is powered on\n"); netif_info(efx, hw, efx->net_dev, "PHY is powered on\n");
return 0; return 0;
fail_on: fail_on:
...@@ -493,7 +494,7 @@ static int sfn4111t_check_hw(struct efx_nic *efx) ...@@ -493,7 +494,7 @@ static int sfn4111t_check_hw(struct efx_nic *efx)
static void sfn4111t_fini(struct efx_nic *efx) static void sfn4111t_fini(struct efx_nic *efx)
{ {
EFX_INFO(efx, "%s\n", __func__); netif_info(efx, drv, efx->net_dev, "%s\n", __func__);
device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
i2c_unregister_device(falcon_board(efx)->hwmon_client); i2c_unregister_device(falcon_board(efx)->hwmon_client);
...@@ -742,13 +743,14 @@ int falcon_probe_board(struct efx_nic *efx, u16 revision_info) ...@@ -742,13 +743,14 @@ int falcon_probe_board(struct efx_nic *efx, u16 revision_info)
board->type = &board_types[i]; board->type = &board_types[i];
if (board->type) { if (board->type) {
EFX_INFO(efx, "board is %s rev %c%d\n", netif_info(efx, probe, efx->net_dev, "board is %s rev %c%d\n",
(efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC) (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
? board->type->ref_model : board->type->gen_type, ? board->type->ref_model : board->type->gen_type,
'A' + board->major, board->minor); 'A' + board->major, board->minor);
return 0; return 0;
} else { } else {
EFX_ERR(efx, "unknown board type %d\n", type_id); netif_err(efx, probe, efx->net_dev, "unknown board type %d\n",
type_id);
return -ENODEV; return -ENODEV;
} }
} }
...@@ -81,7 +81,8 @@ int falcon_reset_xaui(struct efx_nic *efx) ...@@ -81,7 +81,8 @@ int falcon_reset_xaui(struct efx_nic *efx)
} }
udelay(10); udelay(10);
} }
EFX_ERR(efx, "timed out waiting for XAUI/XGXS reset\n"); netif_err(efx, hw, efx->net_dev,
"timed out waiting for XAUI/XGXS reset\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -256,7 +257,7 @@ static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries) ...@@ -256,7 +257,7 @@ static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries)
falcon_stop_nic_stats(efx); falcon_stop_nic_stats(efx);
while (!mac_up && tries) { while (!mac_up && tries) {
EFX_LOG(efx, "bashing xaui\n"); netif_dbg(efx, hw, efx->net_dev, "bashing xaui\n");
falcon_reset_xaui(efx); falcon_reset_xaui(efx);
udelay(200); udelay(200);
......
...@@ -78,8 +78,9 @@ static inline void efx_writeo(struct efx_nic *efx, efx_oword_t *value, ...@@ -78,8 +78,9 @@ static inline void efx_writeo(struct efx_nic *efx, efx_oword_t *value,
{ {
unsigned long flags __attribute__ ((unused)); unsigned long flags __attribute__ ((unused));
EFX_REGDUMP(efx, "writing register %x with " EFX_OWORD_FMT "\n", reg, netif_vdbg(efx, hw, efx->net_dev,
EFX_OWORD_VAL(*value)); "writing register %x with " EFX_OWORD_FMT "\n", reg,
EFX_OWORD_VAL(*value));
spin_lock_irqsave(&efx->biu_lock, flags); spin_lock_irqsave(&efx->biu_lock, flags);
#ifdef EFX_USE_QWORD_IO #ifdef EFX_USE_QWORD_IO
...@@ -105,8 +106,9 @@ static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase, ...@@ -105,8 +106,9 @@ static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase,
unsigned int addr = index * sizeof(*value); unsigned int addr = index * sizeof(*value);
unsigned long flags __attribute__ ((unused)); unsigned long flags __attribute__ ((unused));
EFX_REGDUMP(efx, "writing SRAM address %x with " EFX_QWORD_FMT "\n", netif_vdbg(efx, hw, efx->net_dev,
addr, EFX_QWORD_VAL(*value)); "writing SRAM address %x with " EFX_QWORD_FMT "\n",
addr, EFX_QWORD_VAL(*value));
spin_lock_irqsave(&efx->biu_lock, flags); spin_lock_irqsave(&efx->biu_lock, flags);
#ifdef EFX_USE_QWORD_IO #ifdef EFX_USE_QWORD_IO
...@@ -129,8 +131,9 @@ static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase, ...@@ -129,8 +131,9 @@ static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase,
static inline void efx_writed(struct efx_nic *efx, efx_dword_t *value, static inline void efx_writed(struct efx_nic *efx, efx_dword_t *value,
unsigned int reg) unsigned int reg)
{ {
EFX_REGDUMP(efx, "writing partial register %x with "EFX_DWORD_FMT"\n", netif_vdbg(efx, hw, efx->net_dev,
reg, EFX_DWORD_VAL(*value)); "writing partial register %x with "EFX_DWORD_FMT"\n",
reg, EFX_DWORD_VAL(*value));
/* No lock required */ /* No lock required */
_efx_writed(efx, value->u32[0], reg); _efx_writed(efx, value->u32[0], reg);
...@@ -155,8 +158,9 @@ static inline void efx_reado(struct efx_nic *efx, efx_oword_t *value, ...@@ -155,8 +158,9 @@ static inline void efx_reado(struct efx_nic *efx, efx_oword_t *value,
value->u32[3] = _efx_readd(efx, reg + 12); value->u32[3] = _efx_readd(efx, reg + 12);
spin_unlock_irqrestore(&efx->biu_lock, flags); spin_unlock_irqrestore(&efx->biu_lock, flags);
EFX_REGDUMP(efx, "read from register %x, got " EFX_OWORD_FMT "\n", reg, netif_vdbg(efx, hw, efx->net_dev,
EFX_OWORD_VAL(*value)); "read from register %x, got " EFX_OWORD_FMT "\n", reg,
EFX_OWORD_VAL(*value));
} }
/* Read an 8-byte SRAM entry through supplied mapping, /* Read an 8-byte SRAM entry through supplied mapping,
...@@ -177,8 +181,9 @@ static inline void efx_sram_readq(struct efx_nic *efx, void __iomem *membase, ...@@ -177,8 +181,9 @@ static inline void efx_sram_readq(struct efx_nic *efx, void __iomem *membase,
#endif #endif
spin_unlock_irqrestore(&efx->biu_lock, flags); spin_unlock_irqrestore(&efx->biu_lock, flags);
EFX_REGDUMP(efx, "read from SRAM address %x, got "EFX_QWORD_FMT"\n", netif_vdbg(efx, hw, efx->net_dev,
addr, EFX_QWORD_VAL(*value)); "read from SRAM address %x, got "EFX_QWORD_FMT"\n",
addr, EFX_QWORD_VAL(*value));
} }
/* Read dword from register that allows partial writes (sic) */ /* Read dword from register that allows partial writes (sic) */
...@@ -186,8 +191,9 @@ static inline void efx_readd(struct efx_nic *efx, efx_dword_t *value, ...@@ -186,8 +191,9 @@ static inline void efx_readd(struct efx_nic *efx, efx_dword_t *value,
unsigned int reg) unsigned int reg)
{ {
value->u32[0] = _efx_readd(efx, reg); value->u32[0] = _efx_readd(efx, reg);
EFX_REGDUMP(efx, "read from register %x, got "EFX_DWORD_FMT"\n", netif_vdbg(efx, hw, efx->net_dev,
reg, EFX_DWORD_VAL(*value)); "read from register %x, got "EFX_DWORD_FMT"\n",
reg, EFX_DWORD_VAL(*value));
} }
/* Write to a register forming part of a table */ /* Write to a register forming part of a table */
......
...@@ -168,11 +168,12 @@ static int efx_mcdi_poll(struct efx_nic *efx) ...@@ -168,11 +168,12 @@ static int efx_mcdi_poll(struct efx_nic *efx)
error = EFX_DWORD_FIELD(reg, MCDI_HEADER_ERROR); error = EFX_DWORD_FIELD(reg, MCDI_HEADER_ERROR);
if (error && mcdi->resplen == 0) { if (error && mcdi->resplen == 0) {
EFX_ERR(efx, "MC rebooted\n"); netif_err(efx, hw, efx->net_dev, "MC rebooted\n");
rc = EIO; rc = EIO;
} else if ((respseq ^ mcdi->seqno) & SEQ_MASK) { } else if ((respseq ^ mcdi->seqno) & SEQ_MASK) {
EFX_ERR(efx, "MC response mismatch tx seq 0x%x rx seq 0x%x\n", netif_err(efx, hw, efx->net_dev,
respseq, mcdi->seqno); "MC response mismatch tx seq 0x%x rx seq 0x%x\n",
respseq, mcdi->seqno);
rc = EIO; rc = EIO;
} else if (error) { } else if (error) {
efx_readd(efx, &reg, pdu + 4); efx_readd(efx, &reg, pdu + 4);
...@@ -303,8 +304,9 @@ static void efx_mcdi_ev_cpl(struct efx_nic *efx, unsigned int seqno, ...@@ -303,8 +304,9 @@ static void efx_mcdi_ev_cpl(struct efx_nic *efx, unsigned int seqno,
/* The request has been cancelled */ /* The request has been cancelled */
--mcdi->credits; --mcdi->credits;
else else
EFX_ERR(efx, "MC response mismatch tx seq 0x%x rx " netif_err(efx, hw, efx->net_dev,
"seq 0x%x\n", seqno, mcdi->seqno); "MC response mismatch tx seq 0x%x rx "
"seq 0x%x\n", seqno, mcdi->seqno);
} else { } else {
mcdi->resprc = errno; mcdi->resprc = errno;
mcdi->resplen = datalen; mcdi->resplen = datalen;
...@@ -352,8 +354,9 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, ...@@ -352,8 +354,9 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
++mcdi->credits; ++mcdi->credits;
spin_unlock_bh(&mcdi->iface_lock); spin_unlock_bh(&mcdi->iface_lock);
EFX_ERR(efx, "MC command 0x%x inlen %d mode %d timed out\n", netif_err(efx, hw, efx->net_dev,
cmd, (int)inlen, mcdi->mode); "MC command 0x%x inlen %d mode %d timed out\n",
cmd, (int)inlen, mcdi->mode);
} else { } else {
size_t resplen; size_t resplen;
...@@ -374,11 +377,13 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, ...@@ -374,11 +377,13 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
} else if (cmd == MC_CMD_REBOOT && rc == -EIO) } else if (cmd == MC_CMD_REBOOT && rc == -EIO)
; /* Don't reset if MC_CMD_REBOOT returns EIO */ ; /* Don't reset if MC_CMD_REBOOT returns EIO */
else if (rc == -EIO || rc == -EINTR) { else if (rc == -EIO || rc == -EINTR) {
EFX_ERR(efx, "MC fatal error %d\n", -rc); netif_err(efx, hw, efx->net_dev, "MC fatal error %d\n",
-rc);
efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE);
} else } else
EFX_ERR(efx, "MC command 0x%x inlen %d failed rc=%d\n", netif_err(efx, hw, efx->net_dev,
cmd, (int)inlen, -rc); "MC command 0x%x inlen %d failed rc=%d\n",
cmd, (int)inlen, -rc);
} }
efx_mcdi_release(mcdi); efx_mcdi_release(mcdi);
...@@ -534,8 +539,9 @@ static void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev) ...@@ -534,8 +539,9 @@ static void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev)
EFX_BUG_ON_PARANOID(state >= ARRAY_SIZE(sensor_status_names)); EFX_BUG_ON_PARANOID(state >= ARRAY_SIZE(sensor_status_names));
state_txt = sensor_status_names[state]; state_txt = sensor_status_names[state];
EFX_ERR(efx, "Sensor %d (%s) reports condition '%s' for raw value %d\n", netif_err(efx, hw, efx->net_dev,
monitor, name, state_txt, value); "Sensor %d (%s) reports condition '%s' for raw value %d\n",
monitor, name, state_txt, value);
} }
/* Called from falcon_process_eventq for MCDI events */ /* Called from falcon_process_eventq for MCDI events */
...@@ -548,12 +554,13 @@ void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -548,12 +554,13 @@ void efx_mcdi_process_event(struct efx_channel *channel,
switch (code) { switch (code) {
case MCDI_EVENT_CODE_BADSSERT: case MCDI_EVENT_CODE_BADSSERT:
EFX_ERR(efx, "MC watchdog or assertion failure at 0x%x\n", data); netif_err(efx, hw, efx->net_dev,
"MC watchdog or assertion failure at 0x%x\n", data);
efx_mcdi_ev_death(efx, EINTR); efx_mcdi_ev_death(efx, EINTR);
break; break;
case MCDI_EVENT_CODE_PMNOTICE: case MCDI_EVENT_CODE_PMNOTICE:
EFX_INFO(efx, "MCDI PM event.\n"); netif_info(efx, wol, efx->net_dev, "MCDI PM event.\n");
break; break;
case MCDI_EVENT_CODE_CMDDONE: case MCDI_EVENT_CODE_CMDDONE:
...@@ -570,10 +577,11 @@ void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -570,10 +577,11 @@ void efx_mcdi_process_event(struct efx_channel *channel,
efx_mcdi_sensor_event(efx, event); efx_mcdi_sensor_event(efx, event);
break; break;
case MCDI_EVENT_CODE_SCHEDERR: case MCDI_EVENT_CODE_SCHEDERR:
EFX_INFO(efx, "MC Scheduler error address=0x%x\n", data); netif_info(efx, hw, efx->net_dev,
"MC Scheduler error address=0x%x\n", data);
break; break;
case MCDI_EVENT_CODE_REBOOT: case MCDI_EVENT_CODE_REBOOT:
EFX_INFO(efx, "MC Reboot\n"); netif_info(efx, hw, efx->net_dev, "MC Reboot\n");
efx_mcdi_ev_death(efx, EIO); efx_mcdi_ev_death(efx, EIO);
break; break;
case MCDI_EVENT_CODE_MAC_STATS_DMA: case MCDI_EVENT_CODE_MAC_STATS_DMA:
...@@ -581,7 +589,8 @@ void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -581,7 +589,8 @@ void efx_mcdi_process_event(struct efx_channel *channel,
break; break;
default: default:
EFX_ERR(efx, "Unknown MCDI event 0x%x\n", code); netif_err(efx, hw, efx->net_dev, "Unknown MCDI event 0x%x\n",
code);
} }
} }
...@@ -627,7 +636,7 @@ int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build) ...@@ -627,7 +636,7 @@ int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -657,7 +666,7 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, ...@@ -657,7 +666,7 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -695,7 +704,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -695,7 +704,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d len=%d\n", __func__, rc, (int)outlen); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d len=%d\n",
__func__, rc, (int)outlen);
return rc; return rc;
} }
...@@ -724,7 +734,7 @@ int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq) ...@@ -724,7 +734,7 @@ int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -749,8 +759,8 @@ int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out) ...@@ -749,8 +759,8 @@ int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc); __func__, rc);
return rc; return rc;
} }
...@@ -781,7 +791,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, ...@@ -781,7 +791,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -802,7 +812,7 @@ int efx_mcdi_nvram_update_start(struct efx_nic *efx, unsigned int type) ...@@ -802,7 +812,7 @@ int efx_mcdi_nvram_update_start(struct efx_nic *efx, unsigned int type)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -827,7 +837,7 @@ int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type, ...@@ -827,7 +837,7 @@ int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -853,7 +863,7 @@ int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, ...@@ -853,7 +863,7 @@ int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -877,7 +887,7 @@ int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type, ...@@ -877,7 +887,7 @@ int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -898,7 +908,7 @@ int efx_mcdi_nvram_update_finish(struct efx_nic *efx, unsigned int type) ...@@ -898,7 +908,7 @@ int efx_mcdi_nvram_update_finish(struct efx_nic *efx, unsigned int type)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -948,9 +958,10 @@ int efx_mcdi_nvram_test_all(struct efx_nic *efx) ...@@ -948,9 +958,10 @@ int efx_mcdi_nvram_test_all(struct efx_nic *efx)
return 0; return 0;
fail2: fail2:
EFX_ERR(efx, "%s: failed type=%u\n", __func__, type); netif_err(efx, hw, efx->net_dev, "%s: failed type=%u\n",
__func__, type);
fail1: fail1:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -994,14 +1005,15 @@ static int efx_mcdi_read_assertion(struct efx_nic *efx) ...@@ -994,14 +1005,15 @@ static int efx_mcdi_read_assertion(struct efx_nic *efx)
: (flags == MC_CMD_GET_ASSERTS_FLAGS_WDOG_FIRED) : (flags == MC_CMD_GET_ASSERTS_FLAGS_WDOG_FIRED)
? "watchdog reset" ? "watchdog reset"
: "unknown assertion"; : "unknown assertion";
EFX_ERR(efx, "MCPU %s at PC = 0x%.8x in thread 0x%.8x\n", reason, netif_err(efx, hw, efx->net_dev,
MCDI_DWORD(outbuf, GET_ASSERTS_OUT_SAVED_PC_OFFS), "MCPU %s at PC = 0x%.8x in thread 0x%.8x\n", reason,
MCDI_DWORD(outbuf, GET_ASSERTS_OUT_THREAD_OFFS)); MCDI_DWORD(outbuf, GET_ASSERTS_OUT_SAVED_PC_OFFS),
MCDI_DWORD(outbuf, GET_ASSERTS_OUT_THREAD_OFFS));
/* Print out the registers */ /* Print out the registers */
ofst = MC_CMD_GET_ASSERTS_OUT_GP_REGS_OFFS_OFST; ofst = MC_CMD_GET_ASSERTS_OUT_GP_REGS_OFFS_OFST;
for (index = 1; index < 32; index++) { for (index = 1; index < 32; index++) {
EFX_ERR(efx, "R%.2d (?): 0x%.8x\n", index, netif_err(efx, hw, efx->net_dev, "R%.2d (?): 0x%.8x\n", index,
MCDI_DWORD2(outbuf, ofst)); MCDI_DWORD2(outbuf, ofst));
ofst += sizeof(efx_dword_t); ofst += sizeof(efx_dword_t);
} }
...@@ -1050,14 +1062,16 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) ...@@ -1050,14 +1062,16 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
rc = efx_mcdi_rpc(efx, MC_CMD_SET_ID_LED, inbuf, sizeof(inbuf), rc = efx_mcdi_rpc(efx, MC_CMD_SET_ID_LED, inbuf, sizeof(inbuf),
NULL, 0, NULL); NULL, 0, NULL);
if (rc) if (rc)
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc);
} }
int efx_mcdi_reset_port(struct efx_nic *efx) int efx_mcdi_reset_port(struct efx_nic *efx)
{ {
int rc = efx_mcdi_rpc(efx, MC_CMD_PORT_RESET, NULL, 0, NULL, 0, NULL); int rc = efx_mcdi_rpc(efx, MC_CMD_PORT_RESET, NULL, 0, NULL, 0, NULL);
if (rc) if (rc)
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc);
return rc; return rc;
} }
...@@ -1075,7 +1089,7 @@ int efx_mcdi_reset_mc(struct efx_nic *efx) ...@@ -1075,7 +1089,7 @@ int efx_mcdi_reset_mc(struct efx_nic *efx)
return 0; return 0;
if (rc == 0) if (rc == 0)
rc = -EIO; rc = -EIO;
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -1108,7 +1122,7 @@ int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type, ...@@ -1108,7 +1122,7 @@ int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
fail: fail:
*id_out = -1; *id_out = -1;
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -1143,7 +1157,7 @@ int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out) ...@@ -1143,7 +1157,7 @@ int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out)
fail: fail:
*id_out = -1; *id_out = -1;
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -1163,7 +1177,7 @@ int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id) ...@@ -1163,7 +1177,7 @@ int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -1179,7 +1193,7 @@ int efx_mcdi_wol_filter_reset(struct efx_nic *efx) ...@@ -1179,7 +1193,7 @@ int efx_mcdi_wol_filter_reset(struct efx_nic *efx)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -69,8 +69,8 @@ static int efx_mcdi_get_mac_faults(struct efx_nic *efx, u32 *faults) ...@@ -69,8 +69,8 @@ static int efx_mcdi_get_mac_faults(struct efx_nic *efx, u32 *faults)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc); __func__, rc);
return rc; return rc;
} }
...@@ -110,8 +110,8 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, ...@@ -110,8 +110,8 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: %s failed rc=%d\n", netif_err(efx, hw, efx->net_dev, "%s: %s failed rc=%d\n",
__func__, enable ? "enable" : "disable", rc); __func__, enable ? "enable" : "disable", rc);
return rc; return rc;
} }
......
...@@ -71,7 +71,7 @@ efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg) ...@@ -71,7 +71,7 @@ efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -97,7 +97,7 @@ static int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities, ...@@ -97,7 +97,7 @@ static int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -122,7 +122,7 @@ static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes) ...@@ -122,7 +122,7 @@ static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -150,7 +150,7 @@ int efx_mcdi_mdio_read(struct efx_nic *efx, unsigned int bus, ...@@ -150,7 +150,7 @@ int efx_mcdi_mdio_read(struct efx_nic *efx, unsigned int bus,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -178,7 +178,7 @@ int efx_mcdi_mdio_write(struct efx_nic *efx, unsigned int bus, ...@@ -178,7 +178,7 @@ int efx_mcdi_mdio_write(struct efx_nic *efx, unsigned int bus,
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -466,8 +466,8 @@ void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa) ...@@ -466,8 +466,8 @@ void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa)
rmtadv |= ADVERTISED_Asym_Pause; rmtadv |= ADVERTISED_Asym_Pause;
if ((efx->wanted_fc & EFX_FC_TX) && rmtadv == ADVERTISED_Asym_Pause) if ((efx->wanted_fc & EFX_FC_TX) && rmtadv == ADVERTISED_Asym_Pause)
EFX_ERR(efx, "warning: link partner doesn't support " netif_err(efx, link, efx->net_dev,
"pause frames"); "warning: link partner doesn't support pause frames");
} }
static bool efx_mcdi_phy_poll(struct efx_nic *efx) static bool efx_mcdi_phy_poll(struct efx_nic *efx)
...@@ -483,7 +483,8 @@ static bool efx_mcdi_phy_poll(struct efx_nic *efx) ...@@ -483,7 +483,8 @@ static bool efx_mcdi_phy_poll(struct efx_nic *efx)
rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
outbuf, sizeof(outbuf), NULL); outbuf, sizeof(outbuf), NULL);
if (rc) { if (rc) {
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc);
efx->link_state.up = false; efx->link_state.up = false;
} else { } else {
efx_mcdi_phy_decode_link( efx_mcdi_phy_decode_link(
...@@ -526,7 +527,8 @@ static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *e ...@@ -526,7 +527,8 @@ static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *e
rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
outbuf, sizeof(outbuf), NULL); outbuf, sizeof(outbuf), NULL);
if (rc) { if (rc) {
EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc);
return; return;
} }
ecmd->lp_advertising = ecmd->lp_advertising =
......
...@@ -63,7 +63,8 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal) ...@@ -63,7 +63,8 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
/* Read MMD STATUS2 to check it is responding. */ /* Read MMD STATUS2 to check it is responding. */
status = efx_mdio_read(efx, mmd, MDIO_STAT2); status = efx_mdio_read(efx, mmd, MDIO_STAT2);
if ((status & MDIO_STAT2_DEVPRST) != MDIO_STAT2_DEVPRST_VAL) { if ((status & MDIO_STAT2_DEVPRST) != MDIO_STAT2_DEVPRST_VAL) {
EFX_ERR(efx, "PHY MMD %d not responding.\n", mmd); netif_err(efx, hw, efx->net_dev,
"PHY MMD %d not responding.\n", mmd);
return -EIO; return -EIO;
} }
} }
...@@ -72,12 +73,14 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal) ...@@ -72,12 +73,14 @@ static int efx_mdio_check_mmd(struct efx_nic *efx, int mmd, int fault_fatal)
status = efx_mdio_read(efx, mmd, MDIO_STAT1); status = efx_mdio_read(efx, mmd, MDIO_STAT1);
if (status & MDIO_STAT1_FAULT) { if (status & MDIO_STAT1_FAULT) {
if (fault_fatal) { if (fault_fatal) {
EFX_ERR(efx, "PHY MMD %d reporting fatal" netif_err(efx, hw, efx->net_dev,
" fault: status %x\n", mmd, status); "PHY MMD %d reporting fatal"
" fault: status %x\n", mmd, status);
return -EIO; return -EIO;
} else { } else {
EFX_LOG(efx, "PHY MMD %d reporting status" netif_dbg(efx, hw, efx->net_dev,
" %x (expected)\n", mmd, status); "PHY MMD %d reporting status"
" %x (expected)\n", mmd, status);
} }
} }
return 0; return 0;
...@@ -103,8 +106,9 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask) ...@@ -103,8 +106,9 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask)
if (mask & 1) { if (mask & 1) {
stat = efx_mdio_read(efx, mmd, MDIO_CTRL1); stat = efx_mdio_read(efx, mmd, MDIO_CTRL1);
if (stat < 0) { if (stat < 0) {
EFX_ERR(efx, "failed to read status of" netif_err(efx, hw, efx->net_dev,
" MMD %d\n", mmd); "failed to read status of"
" MMD %d\n", mmd);
return -EIO; return -EIO;
} }
if (stat & MDIO_CTRL1_RESET) if (stat & MDIO_CTRL1_RESET)
...@@ -119,8 +123,9 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask) ...@@ -119,8 +123,9 @@ int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask)
msleep(spintime); msleep(spintime);
} }
if (in_reset != 0) { if (in_reset != 0) {
EFX_ERR(efx, "not all MMDs came out of reset in time." netif_err(efx, hw, efx->net_dev,
" MMDs still in reset: %x\n", in_reset); "not all MMDs came out of reset in time."
" MMDs still in reset: %x\n", in_reset);
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
} }
return rc; return rc;
...@@ -142,16 +147,18 @@ int efx_mdio_check_mmds(struct efx_nic *efx, ...@@ -142,16 +147,18 @@ int efx_mdio_check_mmds(struct efx_nic *efx,
devs1 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS1); devs1 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS1);
devs2 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS2); devs2 = efx_mdio_read(efx, probe_mmd, MDIO_DEVS2);
if (devs1 < 0 || devs2 < 0) { if (devs1 < 0 || devs2 < 0) {
EFX_ERR(efx, "failed to read devices present\n"); netif_err(efx, hw, efx->net_dev,
"failed to read devices present\n");
return -EIO; return -EIO;
} }
devices = devs1 | (devs2 << 16); devices = devs1 | (devs2 << 16);
if ((devices & mmd_mask) != mmd_mask) { if ((devices & mmd_mask) != mmd_mask) {
EFX_ERR(efx, "required MMDs not present: got %x, " netif_err(efx, hw, efx->net_dev,
"wanted %x\n", devices, mmd_mask); "required MMDs not present: got %x, wanted %x\n",
devices, mmd_mask);
return -ENODEV; return -ENODEV;
} }
EFX_TRACE(efx, "Devices present: %x\n", devices); netif_vdbg(efx, hw, efx->net_dev, "Devices present: %x\n", devices);
/* Check all required MMDs are responding and happy. */ /* Check all required MMDs are responding and happy. */
while (mmd_mask) { while (mmd_mask) {
...@@ -219,7 +226,7 @@ static void efx_mdio_set_mmd_lpower(struct efx_nic *efx, ...@@ -219,7 +226,7 @@ static void efx_mdio_set_mmd_lpower(struct efx_nic *efx,
{ {
int stat = efx_mdio_read(efx, mmd, MDIO_STAT1); int stat = efx_mdio_read(efx, mmd, MDIO_STAT1);
EFX_TRACE(efx, "Setting low power mode for MMD %d to %d\n", netif_vdbg(efx, drv, efx->net_dev, "Setting low power mode for MMD %d to %d\n",
mmd, lpower); mmd, lpower);
if (stat & MDIO_STAT1_LPOWERABLE) { if (stat & MDIO_STAT1_LPOWERABLE) {
...@@ -349,8 +356,8 @@ int efx_mdio_test_alive(struct efx_nic *efx) ...@@ -349,8 +356,8 @@ int efx_mdio_test_alive(struct efx_nic *efx)
if ((physid1 == 0x0000) || (physid1 == 0xffff) || if ((physid1 == 0x0000) || (physid1 == 0xffff) ||
(physid2 == 0x0000) || (physid2 == 0xffff)) { (physid2 == 0x0000) || (physid2 == 0xffff)) {
EFX_ERR(efx, "no MDIO PHY present with ID %d\n", netif_err(efx, hw, efx->net_dev,
efx->mdio.prtad); "no MDIO PHY present with ID %d\n", efx->mdio.prtad);
rc = -EINVAL; rc = -EINVAL;
} else { } else {
rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0); rc = efx_mdio_check_mmds(efx, efx->mdio.mmds, 0);
......
...@@ -51,7 +51,8 @@ static inline bool efx_mdio_phyxgxs_lane_sync(struct efx_nic *efx) ...@@ -51,7 +51,8 @@ static inline bool efx_mdio_phyxgxs_lane_sync(struct efx_nic *efx)
sync = !!(lane_status & MDIO_PHYXS_LNSTAT_ALIGN); sync = !!(lane_status & MDIO_PHYXS_LNSTAT_ALIGN);
if (!sync) if (!sync)
EFX_LOG(efx, "XGXS lane status: %x\n", lane_status); netif_dbg(efx, hw, efx->net_dev, "XGXS lane status: %x\n",
lane_status);
return sync; return sync;
} }
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#ifndef EFX_NET_DRIVER_H #ifndef EFX_NET_DRIVER_H
#define EFX_NET_DRIVER_H #define EFX_NET_DRIVER_H
#if defined(EFX_ENABLE_DEBUG) && !defined(DEBUG)
#define DEBUG
#endif
#include <linux/version.h> #include <linux/version.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -48,35 +52,6 @@ ...@@ -48,35 +52,6 @@
#define EFX_WARN_ON_PARANOID(x) do {} while (0) #define EFX_WARN_ON_PARANOID(x) do {} while (0)
#endif #endif
/* Un-rate-limited logging */
#define EFX_ERR(efx, fmt, args...) \
dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, efx_dev_name(efx), ##args)
#define EFX_INFO(efx, fmt, args...) \
dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, efx_dev_name(efx), ##args)
#ifdef EFX_ENABLE_DEBUG
#define EFX_LOG(efx, fmt, args...) \
dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)
#else
#define EFX_LOG(efx, fmt, args...) \
dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args)
#endif
#define EFX_TRACE(efx, fmt, args...) do {} while (0)
#define EFX_REGDUMP(efx, fmt, args...) do {} while (0)
/* Rate-limited logging */
#define EFX_ERR_RL(efx, fmt, args...) \
do {if (net_ratelimit()) EFX_ERR(efx, fmt, ##args); } while (0)
#define EFX_INFO_RL(efx, fmt, args...) \
do {if (net_ratelimit()) EFX_INFO(efx, fmt, ##args); } while (0)
#define EFX_LOG_RL(efx, fmt, args...) \
do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0)
/************************************************************************** /**************************************************************************
* *
* Efx data structures * Efx data structures
...@@ -663,6 +638,7 @@ union efx_multicast_hash { ...@@ -663,6 +638,7 @@ union efx_multicast_hash {
* @interrupt_mode: Interrupt mode * @interrupt_mode: Interrupt mode
* @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
* @irq_rx_moderation: IRQ moderation time for RX event queues * @irq_rx_moderation: IRQ moderation time for RX event queues
* @msg_enable: Log message enable flags
* @state: Device state flag. Serialised by the rtnl_lock. * @state: Device state flag. Serialised by the rtnl_lock.
* @reset_pending: Pending reset method (normally RESET_TYPE_NONE) * @reset_pending: Pending reset method (normally RESET_TYPE_NONE)
* @tx_queue: TX DMA queues * @tx_queue: TX DMA queues
...@@ -746,6 +722,7 @@ struct efx_nic { ...@@ -746,6 +722,7 @@ struct efx_nic {
enum efx_int_mode interrupt_mode; enum efx_int_mode interrupt_mode;
bool irq_rx_adaptive; bool irq_rx_adaptive;
unsigned int irq_rx_moderation; unsigned int irq_rx_moderation;
u32 msg_enable;
enum nic_state state; enum nic_state state;
enum reset_type reset_pending; enum reset_type reset_pending;
......
This diff is collapsed.
...@@ -91,9 +91,10 @@ static int qt2025c_wait_heartbeat(struct efx_nic *efx) ...@@ -91,9 +91,10 @@ static int qt2025c_wait_heartbeat(struct efx_nic *efx)
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
/* Some cables have EEPROMs that conflict with the /* Some cables have EEPROMs that conflict with the
* PHY's on-board EEPROM so it cannot load firmware */ * PHY's on-board EEPROM so it cannot load firmware */
EFX_ERR(efx, "If an SFP+ direct attach cable is" netif_err(efx, hw, efx->net_dev,
" connected, please check that it complies" "If an SFP+ direct attach cable is"
" with the SFP+ specification\n"); " connected, please check that it complies"
" with the SFP+ specification\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
msleep(QT2025C_HEARTB_WAIT); msleep(QT2025C_HEARTB_WAIT);
...@@ -145,7 +146,8 @@ static int qt2025c_wait_reset(struct efx_nic *efx) ...@@ -145,7 +146,8 @@ static int qt2025c_wait_reset(struct efx_nic *efx)
/* Bug 17689: occasionally heartbeat starts but firmware status /* Bug 17689: occasionally heartbeat starts but firmware status
* code never progresses beyond 0x00. Try again, once, after * code never progresses beyond 0x00. Try again, once, after
* restarting execution of the firmware image. */ * restarting execution of the firmware image. */
EFX_LOG(efx, "bashing QT2025C microcontroller\n"); netif_dbg(efx, hw, efx->net_dev,
"bashing QT2025C microcontroller\n");
qt2025c_restart_firmware(efx); qt2025c_restart_firmware(efx);
rc = qt2025c_wait_heartbeat(efx); rc = qt2025c_wait_heartbeat(efx);
if (rc != 0) if (rc != 0)
...@@ -165,11 +167,12 @@ static void qt2025c_firmware_id(struct efx_nic *efx) ...@@ -165,11 +167,12 @@ static void qt2025c_firmware_id(struct efx_nic *efx)
for (i = 0; i < sizeof(firmware_id); i++) for (i = 0; i < sizeof(firmware_id); i++)
firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS, firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS,
PCS_FW_PRODUCT_CODE_1 + i); PCS_FW_PRODUCT_CODE_1 + i);
EFX_INFO(efx, "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n", netif_info(efx, probe, efx->net_dev,
(firmware_id[0] << 8) | firmware_id[1], firmware_id[2], "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n",
firmware_id[3] >> 4, firmware_id[3] & 0xf, (firmware_id[0] << 8) | firmware_id[1], firmware_id[2],
firmware_id[4], firmware_id[5], firmware_id[3] >> 4, firmware_id[3] & 0xf,
firmware_id[6], firmware_id[7], firmware_id[8]); firmware_id[4], firmware_id[5],
firmware_id[6], firmware_id[7], firmware_id[8]);
phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) | phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) |
((firmware_id[3] & 0x0f) << 16) | ((firmware_id[3] & 0x0f) << 16) |
(firmware_id[4] << 8) | firmware_id[5]; (firmware_id[4] << 8) | firmware_id[5];
...@@ -198,7 +201,7 @@ static void qt2025c_bug17190_workaround(struct efx_nic *efx) ...@@ -198,7 +201,7 @@ static void qt2025c_bug17190_workaround(struct efx_nic *efx)
} }
if (time_after_eq(jiffies, phy_data->bug17190_timer)) { if (time_after_eq(jiffies, phy_data->bug17190_timer)) {
EFX_LOG(efx, "bashing QT2025C PMA/PMD\n"); netif_dbg(efx, hw, efx->net_dev, "bashing QT2025C PMA/PMD\n");
efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1,
MDIO_PMA_CTRL1_LOOPBACK, true); MDIO_PMA_CTRL1_LOOPBACK, true);
msleep(100); msleep(100);
...@@ -231,7 +234,8 @@ static int qt2025c_select_phy_mode(struct efx_nic *efx) ...@@ -231,7 +234,8 @@ static int qt2025c_select_phy_mode(struct efx_nic *efx)
reg = efx_mdio_read(efx, 1, 0xc319); reg = efx_mdio_read(efx, 1, 0xc319);
if ((reg & 0x0038) == phy_op_mode) if ((reg & 0x0038) == phy_op_mode)
return 0; return 0;
EFX_LOG(efx, "Switching PHY to mode 0x%04x\n", phy_op_mode); netif_dbg(efx, hw, efx->net_dev, "Switching PHY to mode 0x%04x\n",
phy_op_mode);
/* This sequence replicates the register writes configured in the boot /* This sequence replicates the register writes configured in the boot
* EEPROM (including the differences between board revisions), except * EEPROM (including the differences between board revisions), except
...@@ -287,8 +291,9 @@ static int qt2025c_select_phy_mode(struct efx_nic *efx) ...@@ -287,8 +291,9 @@ static int qt2025c_select_phy_mode(struct efx_nic *efx)
/* Wait for the microcontroller to be ready again */ /* Wait for the microcontroller to be ready again */
rc = qt2025c_wait_reset(efx); rc = qt2025c_wait_reset(efx);
if (rc < 0) { if (rc < 0) {
EFX_ERR(efx, "PHY microcontroller reset during mode switch " netif_err(efx, hw, efx->net_dev,
"timed out\n"); "PHY microcontroller reset during mode switch "
"timed out\n");
return rc; return rc;
} }
...@@ -324,7 +329,7 @@ static int qt202x_reset_phy(struct efx_nic *efx) ...@@ -324,7 +329,7 @@ static int qt202x_reset_phy(struct efx_nic *efx)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "PHY reset timed out\n"); netif_err(efx, hw, efx->net_dev, "PHY reset timed out\n");
return rc; return rc;
} }
...@@ -353,14 +358,15 @@ static int qt202x_phy_init(struct efx_nic *efx) ...@@ -353,14 +358,15 @@ static int qt202x_phy_init(struct efx_nic *efx)
rc = qt202x_reset_phy(efx); rc = qt202x_reset_phy(efx);
if (rc) { if (rc) {
EFX_ERR(efx, "PHY init failed\n"); netif_err(efx, probe, efx->net_dev, "PHY init failed\n");
return rc; return rc;
} }
devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS);
EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", netif_info(efx, probe, efx->net_dev,
devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), "PHY ID reg %x (OUI %06x model %02x revision %x)\n",
efx_mdio_id_rev(devid)); devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid),
efx_mdio_id_rev(devid));
if (efx->phy_type == PHY_TYPE_QT2025C) if (efx->phy_type == PHY_TYPE_QT2025C)
qt2025c_firmware_id(efx); qt2025c_firmware_id(efx);
......
...@@ -348,10 +348,11 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue) ...@@ -348,10 +348,11 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)
if (space < EFX_RX_BATCH) if (space < EFX_RX_BATCH)
goto out; goto out;
EFX_TRACE(rx_queue->efx, "RX queue %d fast-filling descriptor ring from" netif_vdbg(rx_queue->efx, rx_status, rx_queue->efx->net_dev,
" level %d to level %d using %s allocation\n", "RX queue %d fast-filling descriptor ring from"
rx_queue->queue, fill_level, rx_queue->fast_fill_limit, " level %d to level %d using %s allocation\n",
channel->rx_alloc_push_pages ? "page" : "skb"); rx_queue->queue, fill_level, rx_queue->fast_fill_limit,
channel->rx_alloc_push_pages ? "page" : "skb");
do { do {
if (channel->rx_alloc_push_pages) if (channel->rx_alloc_push_pages)
...@@ -366,9 +367,10 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue) ...@@ -366,9 +367,10 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)
} }
} while ((space -= EFX_RX_BATCH) >= EFX_RX_BATCH); } while ((space -= EFX_RX_BATCH) >= EFX_RX_BATCH);
EFX_TRACE(rx_queue->efx, "RX queue %d fast-filled descriptor ring " netif_vdbg(rx_queue->efx, rx_status, rx_queue->efx->net_dev,
"to level %d\n", rx_queue->queue, "RX queue %d fast-filled descriptor ring "
rx_queue->added_count - rx_queue->removed_count); "to level %d\n", rx_queue->queue,
rx_queue->added_count - rx_queue->removed_count);
out: out:
if (rx_queue->notified_count != rx_queue->added_count) if (rx_queue->notified_count != rx_queue->added_count)
...@@ -402,10 +404,12 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue, ...@@ -402,10 +404,12 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
*discard = true; *discard = true;
if ((len > rx_buf->len) && EFX_WORKAROUND_8071(efx)) { if ((len > rx_buf->len) && EFX_WORKAROUND_8071(efx)) {
EFX_ERR_RL(efx, " RX queue %d seriously overlength " if (net_ratelimit())
"RX event (0x%x > 0x%x+0x%x). Leaking\n", netif_err(efx, rx_err, efx->net_dev,
rx_queue->queue, len, max_len, " RX queue %d seriously overlength "
efx->type->rx_buffer_padding); "RX event (0x%x > 0x%x+0x%x). Leaking\n",
rx_queue->queue, len, max_len,
efx->type->rx_buffer_padding);
/* If this buffer was skb-allocated, then the meta /* If this buffer was skb-allocated, then the meta
* data at the end of the skb will be trashed. So * data at the end of the skb will be trashed. So
* we have no choice but to leak the fragment. * we have no choice but to leak the fragment.
...@@ -413,8 +417,11 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue, ...@@ -413,8 +417,11 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
*leak_packet = (rx_buf->skb != NULL); *leak_packet = (rx_buf->skb != NULL);
efx_schedule_reset(efx, RESET_TYPE_RX_RECOVERY); efx_schedule_reset(efx, RESET_TYPE_RX_RECOVERY);
} else { } else {
EFX_ERR_RL(efx, " RX queue %d overlength RX event " if (net_ratelimit())
"(0x%x > 0x%x)\n", rx_queue->queue, len, max_len); netif_err(efx, rx_err, efx->net_dev,
" RX queue %d overlength RX event "
"(0x%x > 0x%x)\n",
rx_queue->queue, len, max_len);
} }
rx_queue->channel->n_rx_overlength++; rx_queue->channel->n_rx_overlength++;
...@@ -502,11 +509,12 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, ...@@ -502,11 +509,12 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
efx_rx_packet__check_len(rx_queue, rx_buf, len, efx_rx_packet__check_len(rx_queue, rx_buf, len,
&discard, &leak_packet); &discard, &leak_packet);
EFX_TRACE(efx, "RX queue %d received id %x at %llx+%x %s%s\n", netif_vdbg(efx, rx_status, efx->net_dev,
rx_queue->queue, index, "RX queue %d received id %x at %llx+%x %s%s\n",
(unsigned long long)rx_buf->dma_addr, len, rx_queue->queue, index,
(checksummed ? " [SUMMED]" : ""), (unsigned long long)rx_buf->dma_addr, len,
(discard ? " [DISCARD]" : "")); (checksummed ? " [SUMMED]" : ""),
(discard ? " [DISCARD]" : ""));
/* Discard packet, if instructed to do so */ /* Discard packet, if instructed to do so */
if (unlikely(discard)) { if (unlikely(discard)) {
...@@ -621,7 +629,8 @@ int efx_probe_rx_queue(struct efx_rx_queue *rx_queue) ...@@ -621,7 +629,8 @@ int efx_probe_rx_queue(struct efx_rx_queue *rx_queue)
unsigned int rxq_size; unsigned int rxq_size;
int rc; int rc;
EFX_LOG(efx, "creating RX queue %d\n", rx_queue->queue); netif_dbg(efx, probe, efx->net_dev,
"creating RX queue %d\n", rx_queue->queue);
/* Allocate RX buffers */ /* Allocate RX buffers */
rxq_size = EFX_RXQ_SIZE * sizeof(*rx_queue->buffer); rxq_size = EFX_RXQ_SIZE * sizeof(*rx_queue->buffer);
...@@ -641,7 +650,8 @@ void efx_init_rx_queue(struct efx_rx_queue *rx_queue) ...@@ -641,7 +650,8 @@ void efx_init_rx_queue(struct efx_rx_queue *rx_queue)
{ {
unsigned int max_fill, trigger, limit; unsigned int max_fill, trigger, limit;
EFX_LOG(rx_queue->efx, "initialising RX queue %d\n", rx_queue->queue); netif_dbg(rx_queue->efx, drv, rx_queue->efx->net_dev,
"initialising RX queue %d\n", rx_queue->queue);
/* Initialise ptr fields */ /* Initialise ptr fields */
rx_queue->added_count = 0; rx_queue->added_count = 0;
...@@ -668,7 +678,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue) ...@@ -668,7 +678,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
int i; int i;
struct efx_rx_buffer *rx_buf; struct efx_rx_buffer *rx_buf;
EFX_LOG(rx_queue->efx, "shutting down RX queue %d\n", rx_queue->queue); netif_dbg(rx_queue->efx, drv, rx_queue->efx->net_dev,
"shutting down RX queue %d\n", rx_queue->queue);
del_timer_sync(&rx_queue->slow_fill); del_timer_sync(&rx_queue->slow_fill);
efx_nic_fini_rx(rx_queue); efx_nic_fini_rx(rx_queue);
...@@ -684,7 +695,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue) ...@@ -684,7 +695,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)
void efx_remove_rx_queue(struct efx_rx_queue *rx_queue) void efx_remove_rx_queue(struct efx_rx_queue *rx_queue)
{ {
EFX_LOG(rx_queue->efx, "destroying RX queue %d\n", rx_queue->queue); netif_dbg(rx_queue->efx, drv, rx_queue->efx->net_dev,
"destroying RX queue %d\n", rx_queue->queue);
efx_nic_remove_rx(rx_queue); efx_nic_remove_rx(rx_queue);
......
...@@ -123,7 +123,7 @@ static int efx_test_interrupts(struct efx_nic *efx, ...@@ -123,7 +123,7 @@ static int efx_test_interrupts(struct efx_nic *efx,
{ {
struct efx_channel *channel; struct efx_channel *channel;
EFX_LOG(efx, "testing interrupts\n"); netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n");
tests->interrupt = -1; tests->interrupt = -1;
/* Reset interrupt flag */ /* Reset interrupt flag */
...@@ -142,16 +142,17 @@ static int efx_test_interrupts(struct efx_nic *efx, ...@@ -142,16 +142,17 @@ static int efx_test_interrupts(struct efx_nic *efx,
efx_nic_generate_interrupt(efx); efx_nic_generate_interrupt(efx);
/* Wait for arrival of test interrupt. */ /* Wait for arrival of test interrupt. */
EFX_LOG(efx, "waiting for test interrupt\n"); netif_dbg(efx, drv, efx->net_dev, "waiting for test interrupt\n");
schedule_timeout_uninterruptible(HZ / 10); schedule_timeout_uninterruptible(HZ / 10);
if (efx->last_irq_cpu >= 0) if (efx->last_irq_cpu >= 0)
goto success; goto success;
EFX_ERR(efx, "timed out waiting for interrupt\n"); netif_err(efx, drv, efx->net_dev, "timed out waiting for interrupt\n");
return -ETIMEDOUT; return -ETIMEDOUT;
success: success:
EFX_LOG(efx, "%s test interrupt seen on CPU%d\n", INT_MODE(efx), netif_dbg(efx, drv, efx->net_dev, "%s test interrupt seen on CPU%d\n",
INT_MODE(efx),
efx->last_irq_cpu); efx->last_irq_cpu);
tests->interrupt = 1; tests->interrupt = 1;
return 0; return 0;
...@@ -161,6 +162,7 @@ static int efx_test_interrupts(struct efx_nic *efx, ...@@ -161,6 +162,7 @@ static int efx_test_interrupts(struct efx_nic *efx,
static int efx_test_eventq_irq(struct efx_channel *channel, static int efx_test_eventq_irq(struct efx_channel *channel,
struct efx_self_tests *tests) struct efx_self_tests *tests)
{ {
struct efx_nic *efx = channel->efx;
unsigned int magic_count, count; unsigned int magic_count, count;
tests->eventq_dma[channel->channel] = -1; tests->eventq_dma[channel->channel] = -1;
...@@ -185,29 +187,32 @@ static int efx_test_eventq_irq(struct efx_channel *channel, ...@@ -185,29 +187,32 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
goto eventq_ok; goto eventq_ok;
} while (++count < 2); } while (++count < 2);
EFX_ERR(channel->efx, "channel %d timed out waiting for event queue\n", netif_err(efx, drv, efx->net_dev,
channel->channel); "channel %d timed out waiting for event queue\n",
channel->channel);
/* See if interrupt arrived */ /* See if interrupt arrived */
if (channel->efx->last_irq_cpu >= 0) { if (channel->efx->last_irq_cpu >= 0) {
EFX_ERR(channel->efx, "channel %d saw interrupt on CPU%d " netif_err(efx, drv, efx->net_dev,
"during event queue test\n", channel->channel, "channel %d saw interrupt on CPU%d "
raw_smp_processor_id()); "during event queue test\n", channel->channel,
raw_smp_processor_id());
tests->eventq_int[channel->channel] = 1; tests->eventq_int[channel->channel] = 1;
} }
/* Check to see if event was received even if interrupt wasn't */ /* Check to see if event was received even if interrupt wasn't */
efx_process_channel_now(channel); efx_process_channel_now(channel);
if (channel->magic_count != magic_count) { if (channel->magic_count != magic_count) {
EFX_ERR(channel->efx, "channel %d event was generated, but " netif_err(efx, drv, efx->net_dev,
"failed to trigger an interrupt\n", channel->channel); "channel %d event was generated, but "
"failed to trigger an interrupt\n", channel->channel);
tests->eventq_dma[channel->channel] = 1; tests->eventq_dma[channel->channel] = 1;
} }
return -ETIMEDOUT; return -ETIMEDOUT;
eventq_ok: eventq_ok:
EFX_LOG(channel->efx, "channel %d event queue passed\n", netif_dbg(efx, drv, efx->net_dev, "channel %d event queue passed\n",
channel->channel); channel->channel);
tests->eventq_dma[channel->channel] = 1; tests->eventq_dma[channel->channel] = 1;
tests->eventq_int[channel->channel] = 1; tests->eventq_int[channel->channel] = 1;
tests->eventq_poll[channel->channel] = 1; tests->eventq_poll[channel->channel] = 1;
...@@ -260,51 +265,57 @@ void efx_loopback_rx_packet(struct efx_nic *efx, ...@@ -260,51 +265,57 @@ void efx_loopback_rx_packet(struct efx_nic *efx,
/* Check that header exists */ /* Check that header exists */
if (pkt_len < sizeof(received->header)) { if (pkt_len < sizeof(received->header)) {
EFX_ERR(efx, "saw runt RX packet (length %d) in %s loopback " netif_err(efx, drv, efx->net_dev,
"test\n", pkt_len, LOOPBACK_MODE(efx)); "saw runt RX packet (length %d) in %s loopback "
"test\n", pkt_len, LOOPBACK_MODE(efx));
goto err; goto err;
} }
/* Check that the ethernet header exists */ /* Check that the ethernet header exists */
if (memcmp(&received->header, &payload->header, ETH_HLEN) != 0) { if (memcmp(&received->header, &payload->header, ETH_HLEN) != 0) {
EFX_ERR(efx, "saw non-loopback RX packet in %s loopback test\n", netif_err(efx, drv, efx->net_dev,
LOOPBACK_MODE(efx)); "saw non-loopback RX packet in %s loopback test\n",
LOOPBACK_MODE(efx));
goto err; goto err;
} }
/* Check packet length */ /* Check packet length */
if (pkt_len != sizeof(*payload)) { if (pkt_len != sizeof(*payload)) {
EFX_ERR(efx, "saw incorrect RX packet length %d (wanted %d) in " netif_err(efx, drv, efx->net_dev,
"%s loopback test\n", pkt_len, (int)sizeof(*payload), "saw incorrect RX packet length %d (wanted %d) in "
LOOPBACK_MODE(efx)); "%s loopback test\n", pkt_len, (int)sizeof(*payload),
LOOPBACK_MODE(efx));
goto err; goto err;
} }
/* Check that IP header matches */ /* Check that IP header matches */
if (memcmp(&received->ip, &payload->ip, sizeof(payload->ip)) != 0) { if (memcmp(&received->ip, &payload->ip, sizeof(payload->ip)) != 0) {
EFX_ERR(efx, "saw corrupted IP header in %s loopback test\n", netif_err(efx, drv, efx->net_dev,
LOOPBACK_MODE(efx)); "saw corrupted IP header in %s loopback test\n",
LOOPBACK_MODE(efx));
goto err; goto err;
} }
/* Check that msg and padding matches */ /* Check that msg and padding matches */
if (memcmp(&received->msg, &payload->msg, sizeof(received->msg)) != 0) { if (memcmp(&received->msg, &payload->msg, sizeof(received->msg)) != 0) {
EFX_ERR(efx, "saw corrupted RX packet in %s loopback test\n", netif_err(efx, drv, efx->net_dev,
LOOPBACK_MODE(efx)); "saw corrupted RX packet in %s loopback test\n",
LOOPBACK_MODE(efx));
goto err; goto err;
} }
/* Check that iteration matches */ /* Check that iteration matches */
if (received->iteration != payload->iteration) { if (received->iteration != payload->iteration) {
EFX_ERR(efx, "saw RX packet from iteration %d (wanted %d) in " netif_err(efx, drv, efx->net_dev,
"%s loopback test\n", ntohs(received->iteration), "saw RX packet from iteration %d (wanted %d) in "
ntohs(payload->iteration), LOOPBACK_MODE(efx)); "%s loopback test\n", ntohs(received->iteration),
ntohs(payload->iteration), LOOPBACK_MODE(efx));
goto err; goto err;
} }
/* Increase correct RX count */ /* Increase correct RX count */
EFX_TRACE(efx, "got loopback RX in %s loopback test\n", netif_vdbg(efx, drv, efx->net_dev,
LOOPBACK_MODE(efx)); "got loopback RX in %s loopback test\n", LOOPBACK_MODE(efx));
atomic_inc(&state->rx_good); atomic_inc(&state->rx_good);
return; return;
...@@ -312,10 +323,10 @@ void efx_loopback_rx_packet(struct efx_nic *efx, ...@@ -312,10 +323,10 @@ void efx_loopback_rx_packet(struct efx_nic *efx,
err: err:
#ifdef EFX_ENABLE_DEBUG #ifdef EFX_ENABLE_DEBUG
if (atomic_read(&state->rx_bad) == 0) { if (atomic_read(&state->rx_bad) == 0) {
EFX_ERR(efx, "received packet:\n"); netif_err(efx, drv, efx->net_dev, "received packet:\n");
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1, print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1,
buf_ptr, pkt_len, 0); buf_ptr, pkt_len, 0);
EFX_ERR(efx, "expected packet:\n"); netif_err(efx, drv, efx->net_dev, "expected packet:\n");
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1, print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 0x10, 1,
&state->payload, sizeof(state->payload), 0); &state->payload, sizeof(state->payload), 0);
} }
...@@ -396,9 +407,11 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue) ...@@ -396,9 +407,11 @@ static int efx_begin_loopback(struct efx_tx_queue *tx_queue)
netif_tx_unlock_bh(efx->net_dev); netif_tx_unlock_bh(efx->net_dev);
if (rc != NETDEV_TX_OK) { if (rc != NETDEV_TX_OK) {
EFX_ERR(efx, "TX queue %d could not transmit packet %d " netif_err(efx, drv, efx->net_dev,
"of %d in %s loopback test\n", tx_queue->queue, "TX queue %d could not transmit packet %d of "
i + 1, state->packet_count, LOOPBACK_MODE(efx)); "%d in %s loopback test\n", tx_queue->queue,
i + 1, state->packet_count,
LOOPBACK_MODE(efx));
/* Defer cleaning up the other skbs for the caller */ /* Defer cleaning up the other skbs for the caller */
kfree_skb(skb); kfree_skb(skb);
...@@ -454,20 +467,22 @@ static int efx_end_loopback(struct efx_tx_queue *tx_queue, ...@@ -454,20 +467,22 @@ static int efx_end_loopback(struct efx_tx_queue *tx_queue,
/* Don't free the skbs; they will be picked up on TX /* Don't free the skbs; they will be picked up on TX
* overflow or channel teardown. * overflow or channel teardown.
*/ */
EFX_ERR(efx, "TX queue %d saw only %d out of an expected %d " netif_err(efx, drv, efx->net_dev,
"TX completion events in %s loopback test\n", "TX queue %d saw only %d out of an expected %d "
tx_queue->queue, tx_done, state->packet_count, "TX completion events in %s loopback test\n",
LOOPBACK_MODE(efx)); tx_queue->queue, tx_done, state->packet_count,
LOOPBACK_MODE(efx));
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
/* Allow to fall through so we see the RX errors as well */ /* Allow to fall through so we see the RX errors as well */
} }
/* We may always be up to a flush away from our desired packet total */ /* We may always be up to a flush away from our desired packet total */
if (rx_good != state->packet_count) { if (rx_good != state->packet_count) {
EFX_LOG(efx, "TX queue %d saw only %d out of an expected %d " netif_dbg(efx, drv, efx->net_dev,
"received packets in %s loopback test\n", "TX queue %d saw only %d out of an expected %d "
tx_queue->queue, rx_good, state->packet_count, "received packets in %s loopback test\n",
LOOPBACK_MODE(efx)); tx_queue->queue, rx_good, state->packet_count,
LOOPBACK_MODE(efx));
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
/* Fall through */ /* Fall through */
} }
...@@ -499,9 +514,10 @@ efx_test_loopback(struct efx_tx_queue *tx_queue, ...@@ -499,9 +514,10 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
return -ENOMEM; return -ENOMEM;
state->flush = false; state->flush = false;
EFX_LOG(efx, "TX queue %d testing %s loopback with %d " netif_dbg(efx, drv, efx->net_dev,
"packets\n", tx_queue->queue, LOOPBACK_MODE(efx), "TX queue %d testing %s loopback with %d packets\n",
state->packet_count); tx_queue->queue, LOOPBACK_MODE(efx),
state->packet_count);
efx_iterate_state(efx); efx_iterate_state(efx);
begin_rc = efx_begin_loopback(tx_queue); begin_rc = efx_begin_loopback(tx_queue);
...@@ -525,9 +541,10 @@ efx_test_loopback(struct efx_tx_queue *tx_queue, ...@@ -525,9 +541,10 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
} }
} }
EFX_LOG(efx, "TX queue %d passed %s loopback test with a burst length " netif_dbg(efx, drv, efx->net_dev,
"of %d packets\n", tx_queue->queue, LOOPBACK_MODE(efx), "TX queue %d passed %s loopback test with a burst length "
state->packet_count); "of %d packets\n", tx_queue->queue, LOOPBACK_MODE(efx),
state->packet_count);
return 0; return 0;
} }
...@@ -602,15 +619,17 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests, ...@@ -602,15 +619,17 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests,
rc = __efx_reconfigure_port(efx); rc = __efx_reconfigure_port(efx);
mutex_unlock(&efx->mac_lock); mutex_unlock(&efx->mac_lock);
if (rc) { if (rc) {
EFX_ERR(efx, "unable to move into %s loopback\n", netif_err(efx, drv, efx->net_dev,
LOOPBACK_MODE(efx)); "unable to move into %s loopback\n",
LOOPBACK_MODE(efx));
goto out; goto out;
} }
rc = efx_wait_for_link(efx); rc = efx_wait_for_link(efx);
if (rc) { if (rc) {
EFX_ERR(efx, "loopback %s never came up\n", netif_err(efx, drv, efx->net_dev,
LOOPBACK_MODE(efx)); "loopback %s never came up\n",
LOOPBACK_MODE(efx));
goto out; goto out;
} }
...@@ -718,7 +737,8 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, ...@@ -718,7 +737,8 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
rc_reset = rc; rc_reset = rc;
if (rc_reset) { if (rc_reset) {
EFX_ERR(efx, "Unable to recover from chip test\n"); netif_err(efx, drv, efx->net_dev,
"Unable to recover from chip test\n");
efx_schedule_reset(efx, RESET_TYPE_DISABLE); efx_schedule_reset(efx, RESET_TYPE_DISABLE);
return rc_reset; return rc_reset;
} }
......
...@@ -118,10 +118,11 @@ static int siena_probe_port(struct efx_nic *efx) ...@@ -118,10 +118,11 @@ static int siena_probe_port(struct efx_nic *efx)
MC_CMD_MAC_NSTATS * sizeof(u64)); MC_CMD_MAC_NSTATS * sizeof(u64));
if (rc) if (rc)
return rc; return rc;
EFX_LOG(efx, "stats buffer at %llx (virt %p phys %llx)\n", netif_dbg(efx, probe, efx->net_dev,
(u64)efx->stats_buffer.dma_addr, "stats buffer at %llx (virt %p phys %llx)\n",
efx->stats_buffer.addr, (u64)efx->stats_buffer.dma_addr,
(u64)virt_to_phys(efx->stats_buffer.addr)); efx->stats_buffer.addr,
(u64)virt_to_phys(efx->stats_buffer.addr));
efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 1); efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 1);
...@@ -216,7 +217,8 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -216,7 +217,8 @@ static int siena_probe_nic(struct efx_nic *efx)
efx->nic_data = nic_data; efx->nic_data = nic_data;
if (efx_nic_fpga_ver(efx) != 0) { if (efx_nic_fpga_ver(efx) != 0) {
EFX_ERR(efx, "Siena FPGA not supported\n"); netif_err(efx, probe, efx->net_dev,
"Siena FPGA not supported\n");
rc = -ENODEV; rc = -ENODEV;
goto fail1; goto fail1;
} }
...@@ -233,8 +235,8 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -233,8 +235,8 @@ static int siena_probe_nic(struct efx_nic *efx)
rc = efx_mcdi_fwver(efx, &nic_data->fw_version, &nic_data->fw_build); rc = efx_mcdi_fwver(efx, &nic_data->fw_version, &nic_data->fw_build);
if (rc) { if (rc) {
EFX_ERR(efx, "Failed to read MCPU firmware version - " netif_err(efx, probe, efx->net_dev,
"rc %d\n", rc); "Failed to read MCPU firmware version - rc %d\n", rc);
goto fail1; /* MCPU absent? */ goto fail1; /* MCPU absent? */
} }
...@@ -242,17 +244,19 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -242,17 +244,19 @@ static int siena_probe_nic(struct efx_nic *efx)
* filter settings. We must do this before we reset the NIC */ * filter settings. We must do this before we reset the NIC */
rc = efx_mcdi_drv_attach(efx, true, &already_attached); rc = efx_mcdi_drv_attach(efx, true, &already_attached);
if (rc) { if (rc) {
EFX_ERR(efx, "Unable to register driver with MCPU\n"); netif_err(efx, probe, efx->net_dev,
"Unable to register driver with MCPU\n");
goto fail2; goto fail2;
} }
if (already_attached) if (already_attached)
/* Not a fatal error */ /* Not a fatal error */
EFX_ERR(efx, "Host already registered with MCPU\n"); netif_err(efx, probe, efx->net_dev,
"Host already registered with MCPU\n");
/* Now we can reset the NIC */ /* Now we can reset the NIC */
rc = siena_reset_hw(efx, RESET_TYPE_ALL); rc = siena_reset_hw(efx, RESET_TYPE_ALL);
if (rc) { if (rc) {
EFX_ERR(efx, "failed to reset NIC\n"); netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n");
goto fail3; goto fail3;
} }
...@@ -264,15 +268,17 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -264,15 +268,17 @@ static int siena_probe_nic(struct efx_nic *efx)
goto fail4; goto fail4;
BUG_ON(efx->irq_status.dma_addr & 0x0f); BUG_ON(efx->irq_status.dma_addr & 0x0f);
EFX_LOG(efx, "INT_KER at %llx (virt %p phys %llx)\n", netif_dbg(efx, probe, efx->net_dev,
(unsigned long long)efx->irq_status.dma_addr, "INT_KER at %llx (virt %p phys %llx)\n",
efx->irq_status.addr, (unsigned long long)efx->irq_status.dma_addr,
(unsigned long long)virt_to_phys(efx->irq_status.addr)); efx->irq_status.addr,
(unsigned long long)virt_to_phys(efx->irq_status.addr));
/* Read in the non-volatile configuration */ /* Read in the non-volatile configuration */
rc = siena_probe_nvconfig(efx); rc = siena_probe_nvconfig(efx);
if (rc == -EINVAL) { if (rc == -EINVAL) {
EFX_ERR(efx, "NVRAM is invalid therefore using defaults\n"); netif_err(efx, probe, efx->net_dev,
"NVRAM is invalid therefore using defaults\n");
efx->phy_type = PHY_TYPE_NONE; efx->phy_type = PHY_TYPE_NONE;
efx->mdio.prtad = MDIO_PRTAD_NONE; efx->mdio.prtad = MDIO_PRTAD_NONE;
} else if (rc) { } else if (rc) {
...@@ -344,7 +350,8 @@ static int siena_init_nic(struct efx_nic *efx) ...@@ -344,7 +350,8 @@ static int siena_init_nic(struct efx_nic *efx)
if (efx_nic_rx_xoff_thresh >= 0 || efx_nic_rx_xon_thresh >= 0) if (efx_nic_rx_xoff_thresh >= 0 || efx_nic_rx_xon_thresh >= 0)
/* No MCDI operation has been defined to set thresholds */ /* No MCDI operation has been defined to set thresholds */
EFX_ERR(efx, "ignoring RX flow control thresholds\n"); netif_err(efx, hw, efx->net_dev,
"ignoring RX flow control thresholds\n");
/* Enable event logging */ /* Enable event logging */
rc = efx_mcdi_log_ctrl(efx, true, false, 0); rc = efx_mcdi_log_ctrl(efx, true, false, 0);
...@@ -565,7 +572,8 @@ static int siena_set_wol(struct efx_nic *efx, u32 type) ...@@ -565,7 +572,8 @@ static int siena_set_wol(struct efx_nic *efx, u32 type)
return 0; return 0;
fail: fail:
EFX_ERR(efx, "%s failed: type=%d rc=%d\n", __func__, type, rc); netif_err(efx, hw, efx->net_dev, "%s failed: type=%d rc=%d\n",
__func__, type, rc);
return rc; return rc;
} }
......
...@@ -228,7 +228,8 @@ int sft9001_wait_boot(struct efx_nic *efx) ...@@ -228,7 +228,8 @@ int sft9001_wait_boot(struct efx_nic *efx)
boot_stat = efx_mdio_read(efx, MDIO_MMD_PCS, boot_stat = efx_mdio_read(efx, MDIO_MMD_PCS,
PCS_BOOT_STATUS_REG); PCS_BOOT_STATUS_REG);
if (boot_stat >= 0) { if (boot_stat >= 0) {
EFX_LOG(efx, "PHY boot status = %#x\n", boot_stat); netif_dbg(efx, hw, efx->net_dev,
"PHY boot status = %#x\n", boot_stat);
switch (boot_stat & switch (boot_stat &
((1 << PCS_BOOT_FATAL_ERROR_LBN) | ((1 << PCS_BOOT_FATAL_ERROR_LBN) |
(3 << PCS_BOOT_PROGRESS_LBN) | (3 << PCS_BOOT_PROGRESS_LBN) |
...@@ -463,10 +464,11 @@ static void sfx7101_check_bad_lp(struct efx_nic *efx, bool link_ok) ...@@ -463,10 +464,11 @@ static void sfx7101_check_bad_lp(struct efx_nic *efx, bool link_ok)
reg |= PMA_PMD_LED_OFF << PMA_PMD_LED_RX_LBN; reg |= PMA_PMD_LED_OFF << PMA_PMD_LED_RX_LBN;
} else { } else {
reg |= PMA_PMD_LED_FLASH << PMA_PMD_LED_RX_LBN; reg |= PMA_PMD_LED_FLASH << PMA_PMD_LED_RX_LBN;
EFX_ERR(efx, "appears to be plugged into a port" netif_err(efx, link, efx->net_dev,
" that is not 10GBASE-T capable. The PHY" "appears to be plugged into a port"
" supports 10GBASE-T ONLY, so no link can" " that is not 10GBASE-T capable. The PHY"
" be established\n"); " supports 10GBASE-T ONLY, so no link can"
" be established\n");
} }
efx_mdio_write(efx, MDIO_MMD_PMAPMD, efx_mdio_write(efx, MDIO_MMD_PMAPMD,
PMA_PMD_LED_OVERR_REG, reg); PMA_PMD_LED_OVERR_REG, reg);
......
...@@ -42,7 +42,7 @@ void efx_stop_queue(struct efx_channel *channel) ...@@ -42,7 +42,7 @@ void efx_stop_queue(struct efx_channel *channel)
return; return;
spin_lock_bh(&channel->tx_stop_lock); spin_lock_bh(&channel->tx_stop_lock);
EFX_TRACE(efx, "stop TX queue\n"); netif_vdbg(efx, tx_queued, efx->net_dev, "stop TX queue\n");
atomic_inc(&channel->tx_stop_count); atomic_inc(&channel->tx_stop_count);
netif_tx_stop_queue( netif_tx_stop_queue(
...@@ -64,7 +64,7 @@ void efx_wake_queue(struct efx_channel *channel) ...@@ -64,7 +64,7 @@ void efx_wake_queue(struct efx_channel *channel)
local_bh_disable(); local_bh_disable();
if (atomic_dec_and_lock(&channel->tx_stop_count, if (atomic_dec_and_lock(&channel->tx_stop_count,
&channel->tx_stop_lock)) { &channel->tx_stop_lock)) {
EFX_TRACE(efx, "waking TX queue\n"); netif_vdbg(efx, tx_queued, efx->net_dev, "waking TX queue\n");
netif_tx_wake_queue( netif_tx_wake_queue(
netdev_get_tx_queue( netdev_get_tx_queue(
efx->net_dev, efx->net_dev,
...@@ -94,8 +94,9 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, ...@@ -94,8 +94,9 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
if (buffer->skb) { if (buffer->skb) {
dev_kfree_skb_any((struct sk_buff *) buffer->skb); dev_kfree_skb_any((struct sk_buff *) buffer->skb);
buffer->skb = NULL; buffer->skb = NULL;
EFX_TRACE(tx_queue->efx, "TX queue %d transmission id %x " netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
"complete\n", tx_queue->queue, read_ptr); "TX queue %d transmission id %x complete\n",
tx_queue->queue, tx_queue->read_count);
} }
} }
...@@ -300,9 +301,10 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) ...@@ -300,9 +301,10 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
return NETDEV_TX_OK; return NETDEV_TX_OK;
pci_err: pci_err:
EFX_ERR_RL(efx, " TX queue %d could not map skb with %d bytes %d " netif_err(efx, tx_err, efx->net_dev,
"fragments for DMA\n", tx_queue->queue, skb->len, " TX queue %d could not map skb with %d bytes %d "
skb_shinfo(skb)->nr_frags + 1); "fragments for DMA\n", tx_queue->queue, skb->len,
skb_shinfo(skb)->nr_frags + 1);
/* Mark the packet as transmitted, and free the SKB ourselves */ /* Mark the packet as transmitted, and free the SKB ourselves */
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
...@@ -354,9 +356,9 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue, ...@@ -354,9 +356,9 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue,
while (read_ptr != stop_index) { while (read_ptr != stop_index) {
struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr]; struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
if (unlikely(buffer->len == 0)) { if (unlikely(buffer->len == 0)) {
EFX_ERR(tx_queue->efx, "TX queue %d spurious TX " netif_err(efx, tx_err, efx->net_dev,
"completion id %x\n", tx_queue->queue, "TX queue %d spurious TX completion id %x\n",
read_ptr); tx_queue->queue, read_ptr);
efx_schedule_reset(efx, RESET_TYPE_TX_SKIP); efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
return; return;
} }
...@@ -431,7 +433,8 @@ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue) ...@@ -431,7 +433,8 @@ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue)
unsigned int txq_size; unsigned int txq_size;
int i, rc; int i, rc;
EFX_LOG(efx, "creating TX queue %d\n", tx_queue->queue); netif_dbg(efx, probe, efx->net_dev, "creating TX queue %d\n",
tx_queue->queue);
/* Allocate software ring */ /* Allocate software ring */
txq_size = EFX_TXQ_SIZE * sizeof(*tx_queue->buffer); txq_size = EFX_TXQ_SIZE * sizeof(*tx_queue->buffer);
...@@ -456,7 +459,8 @@ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue) ...@@ -456,7 +459,8 @@ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue)
void efx_init_tx_queue(struct efx_tx_queue *tx_queue) void efx_init_tx_queue(struct efx_tx_queue *tx_queue)
{ {
EFX_LOG(tx_queue->efx, "initialising TX queue %d\n", tx_queue->queue); netif_dbg(tx_queue->efx, drv, tx_queue->efx->net_dev,
"initialising TX queue %d\n", tx_queue->queue);
tx_queue->insert_count = 0; tx_queue->insert_count = 0;
tx_queue->write_count = 0; tx_queue->write_count = 0;
...@@ -488,7 +492,8 @@ void efx_release_tx_buffers(struct efx_tx_queue *tx_queue) ...@@ -488,7 +492,8 @@ void efx_release_tx_buffers(struct efx_tx_queue *tx_queue)
void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) void efx_fini_tx_queue(struct efx_tx_queue *tx_queue)
{ {
EFX_LOG(tx_queue->efx, "shutting down TX queue %d\n", tx_queue->queue); netif_dbg(tx_queue->efx, drv, tx_queue->efx->net_dev,
"shutting down TX queue %d\n", tx_queue->queue);
/* Flush TX queue, remove descriptor ring */ /* Flush TX queue, remove descriptor ring */
efx_nic_fini_tx(tx_queue); efx_nic_fini_tx(tx_queue);
...@@ -507,7 +512,8 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) ...@@ -507,7 +512,8 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue)
void efx_remove_tx_queue(struct efx_tx_queue *tx_queue) void efx_remove_tx_queue(struct efx_tx_queue *tx_queue)
{ {
EFX_LOG(tx_queue->efx, "destroying TX queue %d\n", tx_queue->queue); netif_dbg(tx_queue->efx, drv, tx_queue->efx->net_dev,
"destroying TX queue %d\n", tx_queue->queue);
efx_nic_remove_tx(tx_queue); efx_nic_remove_tx(tx_queue);
kfree(tx_queue->buffer); kfree(tx_queue->buffer);
...@@ -639,8 +645,8 @@ static int efx_tsoh_block_alloc(struct efx_tx_queue *tx_queue) ...@@ -639,8 +645,8 @@ static int efx_tsoh_block_alloc(struct efx_tx_queue *tx_queue)
base_kva = pci_alloc_consistent(pci_dev, PAGE_SIZE, &dma_addr); base_kva = pci_alloc_consistent(pci_dev, PAGE_SIZE, &dma_addr);
if (base_kva == NULL) { if (base_kva == NULL) {
EFX_ERR(tx_queue->efx, "Unable to allocate page for TSO" netif_err(tx_queue->efx, tx_err, tx_queue->efx->net_dev,
" headers\n"); "Unable to allocate page for TSO headers\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1124,7 +1130,8 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, ...@@ -1124,7 +1130,8 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
return NETDEV_TX_OK; return NETDEV_TX_OK;
mem_err: mem_err:
EFX_ERR(efx, "Out of memory for TSO headers, or PCI mapping error\n"); netif_err(efx, tx_err, efx->net_dev,
"Out of memory for TSO headers, or PCI mapping error\n");
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
goto unwind; goto unwind;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment