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/mcdi.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/mcdi.c')
-rw-r--r-- | drivers/net/sfc/mcdi.c | 98 |
1 files changed, 56 insertions, 42 deletions
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c index 93cc3c1b9450..3912b8fed912 100644 --- a/drivers/net/sfc/mcdi.c +++ b/drivers/net/sfc/mcdi.c | |||
@@ -168,11 +168,12 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
168 | error = EFX_DWORD_FIELD(reg, MCDI_HEADER_ERROR); | 168 | error = EFX_DWORD_FIELD(reg, MCDI_HEADER_ERROR); |
169 | 169 | ||
170 | if (error && mcdi->resplen == 0) { | 170 | if (error && mcdi->resplen == 0) { |
171 | EFX_ERR(efx, "MC rebooted\n"); | 171 | netif_err(efx, hw, efx->net_dev, "MC rebooted\n"); |
172 | rc = EIO; | 172 | rc = EIO; |
173 | } else if ((respseq ^ mcdi->seqno) & SEQ_MASK) { | 173 | } else if ((respseq ^ mcdi->seqno) & SEQ_MASK) { |
174 | EFX_ERR(efx, "MC response mismatch tx seq 0x%x rx seq 0x%x\n", | 174 | netif_err(efx, hw, efx->net_dev, |
175 | respseq, mcdi->seqno); | 175 | "MC response mismatch tx seq 0x%x rx seq 0x%x\n", |
176 | respseq, mcdi->seqno); | ||
176 | rc = EIO; | 177 | rc = EIO; |
177 | } else if (error) { | 178 | } else if (error) { |
178 | efx_readd(efx, ®, pdu + 4); | 179 | efx_readd(efx, ®, pdu + 4); |
@@ -303,8 +304,9 @@ static void efx_mcdi_ev_cpl(struct efx_nic *efx, unsigned int seqno, | |||
303 | /* The request has been cancelled */ | 304 | /* The request has been cancelled */ |
304 | --mcdi->credits; | 305 | --mcdi->credits; |
305 | else | 306 | else |
306 | EFX_ERR(efx, "MC response mismatch tx seq 0x%x rx " | 307 | netif_err(efx, hw, efx->net_dev, |
307 | "seq 0x%x\n", seqno, mcdi->seqno); | 308 | "MC response mismatch tx seq 0x%x rx " |
309 | "seq 0x%x\n", seqno, mcdi->seqno); | ||
308 | } else { | 310 | } else { |
309 | mcdi->resprc = errno; | 311 | mcdi->resprc = errno; |
310 | mcdi->resplen = datalen; | 312 | mcdi->resplen = datalen; |
@@ -352,8 +354,9 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, | |||
352 | ++mcdi->credits; | 354 | ++mcdi->credits; |
353 | spin_unlock_bh(&mcdi->iface_lock); | 355 | spin_unlock_bh(&mcdi->iface_lock); |
354 | 356 | ||
355 | EFX_ERR(efx, "MC command 0x%x inlen %d mode %d timed out\n", | 357 | netif_err(efx, hw, efx->net_dev, |
356 | cmd, (int)inlen, mcdi->mode); | 358 | "MC command 0x%x inlen %d mode %d timed out\n", |
359 | cmd, (int)inlen, mcdi->mode); | ||
357 | } else { | 360 | } else { |
358 | size_t resplen; | 361 | size_t resplen; |
359 | 362 | ||
@@ -374,11 +377,13 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, | |||
374 | } else if (cmd == MC_CMD_REBOOT && rc == -EIO) | 377 | } else if (cmd == MC_CMD_REBOOT && rc == -EIO) |
375 | ; /* Don't reset if MC_CMD_REBOOT returns EIO */ | 378 | ; /* Don't reset if MC_CMD_REBOOT returns EIO */ |
376 | else if (rc == -EIO || rc == -EINTR) { | 379 | else if (rc == -EIO || rc == -EINTR) { |
377 | EFX_ERR(efx, "MC fatal error %d\n", -rc); | 380 | netif_err(efx, hw, efx->net_dev, "MC fatal error %d\n", |
381 | -rc); | ||
378 | efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); | 382 | efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); |
379 | } else | 383 | } else |
380 | EFX_ERR(efx, "MC command 0x%x inlen %d failed rc=%d\n", | 384 | netif_err(efx, hw, efx->net_dev, |
381 | cmd, (int)inlen, -rc); | 385 | "MC command 0x%x inlen %d failed rc=%d\n", |
386 | cmd, (int)inlen, -rc); | ||
382 | } | 387 | } |
383 | 388 | ||
384 | efx_mcdi_release(mcdi); | 389 | efx_mcdi_release(mcdi); |
@@ -534,8 +539,9 @@ static void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev) | |||
534 | EFX_BUG_ON_PARANOID(state >= ARRAY_SIZE(sensor_status_names)); | 539 | EFX_BUG_ON_PARANOID(state >= ARRAY_SIZE(sensor_status_names)); |
535 | state_txt = sensor_status_names[state]; | 540 | state_txt = sensor_status_names[state]; |
536 | 541 | ||
537 | EFX_ERR(efx, "Sensor %d (%s) reports condition '%s' for raw value %d\n", | 542 | netif_err(efx, hw, efx->net_dev, |
538 | monitor, name, state_txt, value); | 543 | "Sensor %d (%s) reports condition '%s' for raw value %d\n", |
544 | monitor, name, state_txt, value); | ||
539 | } | 545 | } |
540 | 546 | ||
541 | /* Called from falcon_process_eventq for MCDI events */ | 547 | /* Called from falcon_process_eventq for MCDI events */ |
@@ -548,12 +554,13 @@ void efx_mcdi_process_event(struct efx_channel *channel, | |||
548 | 554 | ||
549 | switch (code) { | 555 | switch (code) { |
550 | case MCDI_EVENT_CODE_BADSSERT: | 556 | case MCDI_EVENT_CODE_BADSSERT: |
551 | EFX_ERR(efx, "MC watchdog or assertion failure at 0x%x\n", data); | 557 | netif_err(efx, hw, efx->net_dev, |
558 | "MC watchdog or assertion failure at 0x%x\n", data); | ||
552 | efx_mcdi_ev_death(efx, EINTR); | 559 | efx_mcdi_ev_death(efx, EINTR); |
553 | break; | 560 | break; |
554 | 561 | ||
555 | case MCDI_EVENT_CODE_PMNOTICE: | 562 | case MCDI_EVENT_CODE_PMNOTICE: |
556 | EFX_INFO(efx, "MCDI PM event.\n"); | 563 | netif_info(efx, wol, efx->net_dev, "MCDI PM event.\n"); |
557 | break; | 564 | break; |
558 | 565 | ||
559 | case MCDI_EVENT_CODE_CMDDONE: | 566 | case MCDI_EVENT_CODE_CMDDONE: |
@@ -570,10 +577,11 @@ void efx_mcdi_process_event(struct efx_channel *channel, | |||
570 | efx_mcdi_sensor_event(efx, event); | 577 | efx_mcdi_sensor_event(efx, event); |
571 | break; | 578 | break; |
572 | case MCDI_EVENT_CODE_SCHEDERR: | 579 | case MCDI_EVENT_CODE_SCHEDERR: |
573 | EFX_INFO(efx, "MC Scheduler error address=0x%x\n", data); | 580 | netif_info(efx, hw, efx->net_dev, |
581 | "MC Scheduler error address=0x%x\n", data); | ||
574 | break; | 582 | break; |
575 | case MCDI_EVENT_CODE_REBOOT: | 583 | case MCDI_EVENT_CODE_REBOOT: |
576 | EFX_INFO(efx, "MC Reboot\n"); | 584 | netif_info(efx, hw, efx->net_dev, "MC Reboot\n"); |
577 | efx_mcdi_ev_death(efx, EIO); | 585 | efx_mcdi_ev_death(efx, EIO); |
578 | break; | 586 | break; |
579 | case MCDI_EVENT_CODE_MAC_STATS_DMA: | 587 | case MCDI_EVENT_CODE_MAC_STATS_DMA: |
@@ -581,7 +589,8 @@ void efx_mcdi_process_event(struct efx_channel *channel, | |||
581 | break; | 589 | break; |
582 | 590 | ||
583 | default: | 591 | default: |
584 | EFX_ERR(efx, "Unknown MCDI event 0x%x\n", code); | 592 | netif_err(efx, hw, efx->net_dev, "Unknown MCDI event 0x%x\n", |
593 | code); | ||
585 | } | 594 | } |
586 | } | 595 | } |
587 | 596 | ||
@@ -627,7 +636,7 @@ int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build) | |||
627 | return 0; | 636 | return 0; |
628 | 637 | ||
629 | fail: | 638 | fail: |
630 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 639 | netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
631 | return rc; | 640 | return rc; |
632 | } | 641 | } |
633 | 642 | ||
@@ -657,7 +666,7 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, | |||
657 | return 0; | 666 | return 0; |
658 | 667 | ||
659 | fail: | 668 | fail: |
660 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 669 | netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
661 | return rc; | 670 | return rc; |
662 | } | 671 | } |
663 | 672 | ||
@@ -695,7 +704,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, | |||
695 | return 0; | 704 | return 0; |
696 | 705 | ||
697 | fail: | 706 | fail: |
698 | EFX_ERR(efx, "%s: failed rc=%d len=%d\n", __func__, rc, (int)outlen); | 707 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d len=%d\n", |
708 | __func__, rc, (int)outlen); | ||
699 | 709 | ||
700 | return rc; | 710 | return rc; |
701 | } | 711 | } |
@@ -724,7 +734,7 @@ int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq) | |||
724 | return 0; | 734 | return 0; |
725 | 735 | ||
726 | fail: | 736 | fail: |
727 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 737 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
728 | return rc; | 738 | return rc; |
729 | } | 739 | } |
730 | 740 | ||
@@ -749,8 +759,8 @@ int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out) | |||
749 | return 0; | 759 | return 0; |
750 | 760 | ||
751 | fail: | 761 | fail: |
752 | EFX_ERR(efx, "%s: failed rc=%d\n", | 762 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", |
753 | __func__, rc); | 763 | __func__, rc); |
754 | return rc; | 764 | return rc; |
755 | } | 765 | } |
756 | 766 | ||
@@ -781,7 +791,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, | |||
781 | return 0; | 791 | return 0; |
782 | 792 | ||
783 | fail: | 793 | fail: |
784 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 794 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
785 | return rc; | 795 | return rc; |
786 | } | 796 | } |
787 | 797 | ||
@@ -802,7 +812,7 @@ int efx_mcdi_nvram_update_start(struct efx_nic *efx, unsigned int type) | |||
802 | return 0; | 812 | return 0; |
803 | 813 | ||
804 | fail: | 814 | fail: |
805 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 815 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
806 | return rc; | 816 | return rc; |
807 | } | 817 | } |
808 | 818 | ||
@@ -827,7 +837,7 @@ int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type, | |||
827 | return 0; | 837 | return 0; |
828 | 838 | ||
829 | fail: | 839 | fail: |
830 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 840 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
831 | return rc; | 841 | return rc; |
832 | } | 842 | } |
833 | 843 | ||
@@ -853,7 +863,7 @@ int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, | |||
853 | return 0; | 863 | return 0; |
854 | 864 | ||
855 | fail: | 865 | fail: |
856 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 866 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
857 | return rc; | 867 | return rc; |
858 | } | 868 | } |
859 | 869 | ||
@@ -877,7 +887,7 @@ int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type, | |||
877 | return 0; | 887 | return 0; |
878 | 888 | ||
879 | fail: | 889 | fail: |
880 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 890 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
881 | return rc; | 891 | return rc; |
882 | } | 892 | } |
883 | 893 | ||
@@ -898,7 +908,7 @@ int efx_mcdi_nvram_update_finish(struct efx_nic *efx, unsigned int type) | |||
898 | return 0; | 908 | return 0; |
899 | 909 | ||
900 | fail: | 910 | fail: |
901 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 911 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
902 | return rc; | 912 | return rc; |
903 | } | 913 | } |
904 | 914 | ||
@@ -948,9 +958,10 @@ int efx_mcdi_nvram_test_all(struct efx_nic *efx) | |||
948 | return 0; | 958 | return 0; |
949 | 959 | ||
950 | fail2: | 960 | fail2: |
951 | EFX_ERR(efx, "%s: failed type=%u\n", __func__, type); | 961 | netif_err(efx, hw, efx->net_dev, "%s: failed type=%u\n", |
962 | __func__, type); | ||
952 | fail1: | 963 | fail1: |
953 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 964 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
954 | return rc; | 965 | return rc; |
955 | } | 966 | } |
956 | 967 | ||
@@ -994,14 +1005,15 @@ static int efx_mcdi_read_assertion(struct efx_nic *efx) | |||
994 | : (flags == MC_CMD_GET_ASSERTS_FLAGS_WDOG_FIRED) | 1005 | : (flags == MC_CMD_GET_ASSERTS_FLAGS_WDOG_FIRED) |
995 | ? "watchdog reset" | 1006 | ? "watchdog reset" |
996 | : "unknown assertion"; | 1007 | : "unknown assertion"; |
997 | EFX_ERR(efx, "MCPU %s at PC = 0x%.8x in thread 0x%.8x\n", reason, | 1008 | netif_err(efx, hw, efx->net_dev, |
998 | MCDI_DWORD(outbuf, GET_ASSERTS_OUT_SAVED_PC_OFFS), | 1009 | "MCPU %s at PC = 0x%.8x in thread 0x%.8x\n", reason, |
999 | MCDI_DWORD(outbuf, GET_ASSERTS_OUT_THREAD_OFFS)); | 1010 | MCDI_DWORD(outbuf, GET_ASSERTS_OUT_SAVED_PC_OFFS), |
1011 | MCDI_DWORD(outbuf, GET_ASSERTS_OUT_THREAD_OFFS)); | ||
1000 | 1012 | ||
1001 | /* Print out the registers */ | 1013 | /* Print out the registers */ |
1002 | ofst = MC_CMD_GET_ASSERTS_OUT_GP_REGS_OFFS_OFST; | 1014 | ofst = MC_CMD_GET_ASSERTS_OUT_GP_REGS_OFFS_OFST; |
1003 | for (index = 1; index < 32; index++) { | 1015 | for (index = 1; index < 32; index++) { |
1004 | EFX_ERR(efx, "R%.2d (?): 0x%.8x\n", index, | 1016 | netif_err(efx, hw, efx->net_dev, "R%.2d (?): 0x%.8x\n", index, |
1005 | MCDI_DWORD2(outbuf, ofst)); | 1017 | MCDI_DWORD2(outbuf, ofst)); |
1006 | ofst += sizeof(efx_dword_t); | 1018 | ofst += sizeof(efx_dword_t); |
1007 | } | 1019 | } |
@@ -1050,14 +1062,16 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) | |||
1050 | rc = efx_mcdi_rpc(efx, MC_CMD_SET_ID_LED, inbuf, sizeof(inbuf), | 1062 | rc = efx_mcdi_rpc(efx, MC_CMD_SET_ID_LED, inbuf, sizeof(inbuf), |
1051 | NULL, 0, NULL); | 1063 | NULL, 0, NULL); |
1052 | if (rc) | 1064 | if (rc) |
1053 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1065 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", |
1066 | __func__, rc); | ||
1054 | } | 1067 | } |
1055 | 1068 | ||
1056 | int efx_mcdi_reset_port(struct efx_nic *efx) | 1069 | int efx_mcdi_reset_port(struct efx_nic *efx) |
1057 | { | 1070 | { |
1058 | int rc = efx_mcdi_rpc(efx, MC_CMD_PORT_RESET, NULL, 0, NULL, 0, NULL); | 1071 | int rc = efx_mcdi_rpc(efx, MC_CMD_PORT_RESET, NULL, 0, NULL, 0, NULL); |
1059 | if (rc) | 1072 | if (rc) |
1060 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1073 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", |
1074 | __func__, rc); | ||
1061 | return rc; | 1075 | return rc; |
1062 | } | 1076 | } |
1063 | 1077 | ||
@@ -1075,7 +1089,7 @@ int efx_mcdi_reset_mc(struct efx_nic *efx) | |||
1075 | return 0; | 1089 | return 0; |
1076 | if (rc == 0) | 1090 | if (rc == 0) |
1077 | rc = -EIO; | 1091 | rc = -EIO; |
1078 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1092 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
1079 | return rc; | 1093 | return rc; |
1080 | } | 1094 | } |
1081 | 1095 | ||
@@ -1108,7 +1122,7 @@ int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type, | |||
1108 | 1122 | ||
1109 | fail: | 1123 | fail: |
1110 | *id_out = -1; | 1124 | *id_out = -1; |
1111 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1125 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
1112 | return rc; | 1126 | return rc; |
1113 | 1127 | ||
1114 | } | 1128 | } |
@@ -1143,7 +1157,7 @@ int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out) | |||
1143 | 1157 | ||
1144 | fail: | 1158 | fail: |
1145 | *id_out = -1; | 1159 | *id_out = -1; |
1146 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1160 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
1147 | return rc; | 1161 | return rc; |
1148 | } | 1162 | } |
1149 | 1163 | ||
@@ -1163,7 +1177,7 @@ int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id) | |||
1163 | return 0; | 1177 | return 0; |
1164 | 1178 | ||
1165 | fail: | 1179 | fail: |
1166 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1180 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
1167 | return rc; | 1181 | return rc; |
1168 | } | 1182 | } |
1169 | 1183 | ||
@@ -1179,7 +1193,7 @@ int efx_mcdi_wol_filter_reset(struct efx_nic *efx) | |||
1179 | return 0; | 1193 | return 0; |
1180 | 1194 | ||
1181 | fail: | 1195 | fail: |
1182 | EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc); | 1196 | netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); |
1183 | return rc; | 1197 | return rc; |
1184 | } | 1198 | } |
1185 | 1199 | ||