diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-06-23 07:30:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-25 01:13:22 -0400 |
commit | 62776d034cc40c49bafdb3551a6ba35f78e3f08d (patch) | |
tree | 1cd2132940ced266ad53619a0c947e153cc83a5e /drivers/net/sfc/ethtool.c | |
parent | 0c605a2061670412d3b5580c92f1e161b1a693d2 (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/ethtool.c')
-rw-r--r-- | drivers/net/sfc/ethtool.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 81b7f39ca5fb..27230a992893 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -218,8 +218,8 @@ int efx_ethtool_set_settings(struct net_device *net_dev, | |||
218 | 218 | ||
219 | /* GMAC does not support 1000Mbps HD */ | 219 | /* GMAC does not support 1000Mbps HD */ |
220 | if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) { | 220 | if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) { |
221 | EFX_LOG(efx, "rejecting unsupported 1000Mbps HD" | 221 | netif_dbg(efx, drv, efx->net_dev, |
222 | " setting\n"); | 222 | "rejecting unsupported 1000Mbps HD setting\n"); |
223 | return -EINVAL; | 223 | return -EINVAL; |
224 | } | 224 | } |
225 | 225 | ||
@@ -256,6 +256,18 @@ static void efx_ethtool_get_regs(struct net_device *net_dev, | |||
256 | efx_nic_get_regs(efx, buf); | 256 | efx_nic_get_regs(efx, buf); |
257 | } | 257 | } |
258 | 258 | ||
259 | static u32 efx_ethtool_get_msglevel(struct net_device *net_dev) | ||
260 | { | ||
261 | struct efx_nic *efx = netdev_priv(net_dev); | ||
262 | return efx->msg_enable; | ||
263 | } | ||
264 | |||
265 | static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable) | ||
266 | { | ||
267 | struct efx_nic *efx = netdev_priv(net_dev); | ||
268 | efx->msg_enable = msg_enable; | ||
269 | } | ||
270 | |||
259 | /** | 271 | /** |
260 | * efx_fill_test - fill in an individual self-test entry | 272 | * efx_fill_test - fill in an individual self-test entry |
261 | * @test_index: Index of the test | 273 | * @test_index: Index of the test |
@@ -553,7 +565,8 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
553 | if (!already_up) { | 565 | if (!already_up) { |
554 | rc = dev_open(efx->net_dev); | 566 | rc = dev_open(efx->net_dev); |
555 | if (rc) { | 567 | if (rc) { |
556 | EFX_ERR(efx, "failed opening device.\n"); | 568 | netif_err(efx, drv, efx->net_dev, |
569 | "failed opening device.\n"); | ||
557 | goto fail2; | 570 | goto fail2; |
558 | } | 571 | } |
559 | } | 572 | } |
@@ -565,9 +578,9 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
565 | if (!already_up) | 578 | if (!already_up) |
566 | dev_close(efx->net_dev); | 579 | dev_close(efx->net_dev); |
567 | 580 | ||
568 | EFX_LOG(efx, "%s %sline self-tests\n", | 581 | netif_dbg(efx, drv, efx->net_dev, "%s %sline self-tests\n", |
569 | rc == 0 ? "passed" : "failed", | 582 | rc == 0 ? "passed" : "failed", |
570 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); | 583 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); |
571 | 584 | ||
572 | fail2: | 585 | fail2: |
573 | fail1: | 586 | fail1: |
@@ -693,8 +706,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, | |||
693 | return -EOPNOTSUPP; | 706 | return -EOPNOTSUPP; |
694 | 707 | ||
695 | if (coalesce->rx_coalesce_usecs || coalesce->tx_coalesce_usecs) { | 708 | if (coalesce->rx_coalesce_usecs || coalesce->tx_coalesce_usecs) { |
696 | EFX_ERR(efx, "invalid coalescing setting. " | 709 | netif_err(efx, drv, efx->net_dev, "invalid coalescing setting. " |
697 | "Only rx/tx_coalesce_usecs_irq are supported\n"); | 710 | "Only rx/tx_coalesce_usecs_irq are supported\n"); |
698 | return -EOPNOTSUPP; | 711 | return -EOPNOTSUPP; |
699 | } | 712 | } |
700 | 713 | ||
@@ -706,8 +719,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, | |||
706 | efx_for_each_tx_queue(tx_queue, efx) { | 719 | efx_for_each_tx_queue(tx_queue, efx) { |
707 | if ((tx_queue->channel->channel < efx->n_rx_channels) && | 720 | if ((tx_queue->channel->channel < efx->n_rx_channels) && |
708 | tx_usecs) { | 721 | tx_usecs) { |
709 | EFX_ERR(efx, "Channel is shared. " | 722 | netif_err(efx, drv, efx->net_dev, "Channel is shared. " |
710 | "Only RX coalescing may be set\n"); | 723 | "Only RX coalescing may be set\n"); |
711 | return -EOPNOTSUPP; | 724 | return -EOPNOTSUPP; |
712 | } | 725 | } |
713 | } | 726 | } |
@@ -735,13 +748,15 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, | |||
735 | (pause->autoneg ? EFX_FC_AUTO : 0)); | 748 | (pause->autoneg ? EFX_FC_AUTO : 0)); |
736 | 749 | ||
737 | if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) { | 750 | if ((wanted_fc & EFX_FC_TX) && !(wanted_fc & EFX_FC_RX)) { |
738 | EFX_LOG(efx, "Flow control unsupported: tx ON rx OFF\n"); | 751 | netif_dbg(efx, drv, efx->net_dev, |
752 | "Flow control unsupported: tx ON rx OFF\n"); | ||
739 | rc = -EINVAL; | 753 | rc = -EINVAL; |
740 | goto out; | 754 | goto out; |
741 | } | 755 | } |
742 | 756 | ||
743 | if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising) { | 757 | if ((wanted_fc & EFX_FC_AUTO) && !efx->link_advertising) { |
744 | EFX_LOG(efx, "Autonegotiation is disabled\n"); | 758 | netif_dbg(efx, drv, efx->net_dev, |
759 | "Autonegotiation is disabled\n"); | ||
745 | rc = -EINVAL; | 760 | rc = -EINVAL; |
746 | goto out; | 761 | goto out; |
747 | } | 762 | } |
@@ -772,8 +787,9 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, | |||
772 | (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { | 787 | (efx->wanted_fc ^ old_fc) & EFX_FC_AUTO) { |
773 | rc = efx->phy_op->reconfigure(efx); | 788 | rc = efx->phy_op->reconfigure(efx); |
774 | if (rc) { | 789 | if (rc) { |
775 | EFX_ERR(efx, "Unable to advertise requested flow " | 790 | netif_err(efx, drv, efx->net_dev, |
776 | "control setting\n"); | 791 | "Unable to advertise requested flow " |
792 | "control setting\n"); | ||
777 | goto out; | 793 | goto out; |
778 | } | 794 | } |
779 | } | 795 | } |
@@ -850,6 +866,8 @@ const struct ethtool_ops efx_ethtool_ops = { | |||
850 | .get_drvinfo = efx_ethtool_get_drvinfo, | 866 | .get_drvinfo = efx_ethtool_get_drvinfo, |
851 | .get_regs_len = efx_ethtool_get_regs_len, | 867 | .get_regs_len = efx_ethtool_get_regs_len, |
852 | .get_regs = efx_ethtool_get_regs, | 868 | .get_regs = efx_ethtool_get_regs, |
869 | .get_msglevel = efx_ethtool_get_msglevel, | ||
870 | .set_msglevel = efx_ethtool_set_msglevel, | ||
853 | .nway_reset = efx_ethtool_nway_reset, | 871 | .nway_reset = efx_ethtool_nway_reset, |
854 | .get_link = efx_ethtool_get_link, | 872 | .get_link = efx_ethtool_get_link, |
855 | .get_eeprom_len = efx_ethtool_get_eeprom_len, | 873 | .get_eeprom_len = efx_ethtool_get_eeprom_len, |