aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2014-11-13 03:23:15 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-12-09 15:57:02 -0500
commit74d0d0ede7c96cbb4cb9b5fa755419e336ba6451 (patch)
tree1eaf83233679b1fa1b540b58d6bd3659642186a9
parentbf06f7a9bafde62fa77e3fce4040355dfbceb894 (diff)
i40e: rework debug messages for NVM update
Rework the debug messages in the NVM update state machine so that we can turn them on and off dynamically rather than forcing a recompile/reload. These can now be turned on with something like: ethtool -s eth1 msglvl 0xf000008f and off with: ethtool -s eth1 msglvl 0xf000000f The high 0xf0000000 gets the driver's attention that we want to change the internal debug flags, and the 0x80 bit is the NVM debug. Change-ID: I5efb9039400304b29a0fd6ddea3f47bb362e6661 Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: Greg Rose <gregory.v.rose@intel.com> Tested-by: Jim Young <jamesx.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c107
1 files changed, 80 insertions, 27 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 25c4f9a3011f..df429bb4eb44 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -61,7 +61,7 @@ i40e_status i40e_init_nvm(struct i40e_hw *hw)
61 } else { /* Blank programming mode */ 61 } else { /* Blank programming mode */
62 nvm->blank_nvm_mode = true; 62 nvm->blank_nvm_mode = true;
63 ret_code = I40E_ERR_NVM_BLANK_MODE; 63 ret_code = I40E_ERR_NVM_BLANK_MODE;
64 hw_dbg(hw, "NVM init error: unsupported blank mode.\n"); 64 i40e_debug(hw, I40E_DEBUG_NVM, "NVM init error: unsupported blank mode.\n");
65 } 65 }
66 66
67 return ret_code; 67 return ret_code;
@@ -118,8 +118,9 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw,
118 hw->nvm.hw_semaphore_timeout = 0; 118 hw->nvm.hw_semaphore_timeout = 0;
119 hw->nvm.hw_semaphore_wait = 119 hw->nvm.hw_semaphore_wait =
120 I40E_MS_TO_GTIME(time) + gtime; 120 I40E_MS_TO_GTIME(time) + gtime;
121 hw_dbg(hw, "NVM acquire timed out, wait %llu ms before trying again.\n", 121 i40e_debug(hw, I40E_DEBUG_NVM,
122 time); 122 "NVM acquire timed out, wait %llu ms before trying again.\n",
123 time);
123 } 124 }
124 } 125 }
125 126
@@ -160,7 +161,7 @@ static i40e_status i40e_poll_sr_srctl_done_bit(struct i40e_hw *hw)
160 udelay(5); 161 udelay(5);
161 } 162 }
162 if (ret_code == I40E_ERR_TIMEOUT) 163 if (ret_code == I40E_ERR_TIMEOUT)
163 hw_dbg(hw, "Done bit in GLNVM_SRCTL not set\n"); 164 i40e_debug(hw, I40E_DEBUG_NVM, "Done bit in GLNVM_SRCTL not set");
164 return ret_code; 165 return ret_code;
165} 166}
166 167
@@ -179,7 +180,9 @@ i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
179 u32 sr_reg; 180 u32 sr_reg;
180 181
181 if (offset >= hw->nvm.sr_size) { 182 if (offset >= hw->nvm.sr_size) {
182 hw_dbg(hw, "NVM read error: Offset beyond Shadow RAM limit.\n"); 183 i40e_debug(hw, I40E_DEBUG_NVM,
184 "NVM read error: offset %d beyond Shadow RAM limit %d\n",
185 offset, hw->nvm.sr_size);
183 ret_code = I40E_ERR_PARAM; 186 ret_code = I40E_ERR_PARAM;
184 goto read_nvm_exit; 187 goto read_nvm_exit;
185 } 188 }
@@ -202,8 +205,9 @@ i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
202 } 205 }
203 } 206 }
204 if (ret_code) 207 if (ret_code)
205 hw_dbg(hw, "NVM read error: Couldn't access Shadow RAM address: 0x%x\n", 208 i40e_debug(hw, I40E_DEBUG_NVM,
206 offset); 209 "NVM read error: Couldn't access Shadow RAM address: 0x%x\n",
210 offset);
207 211
208read_nvm_exit: 212read_nvm_exit:
209 return ret_code; 213 return ret_code;
@@ -263,14 +267,20 @@ static i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
263 * Firmware will check the module-based model. 267 * Firmware will check the module-based model.
264 */ 268 */
265 if ((offset + words) > hw->nvm.sr_size) 269 if ((offset + words) > hw->nvm.sr_size)
266 hw_dbg(hw, "NVM write error: offset beyond Shadow RAM limit.\n"); 270 i40e_debug(hw, I40E_DEBUG_NVM,
271 "NVM write error: offset %d beyond Shadow RAM limit %d\n",
272 (offset + words), hw->nvm.sr_size);
267 else if (words > I40E_SR_SECTOR_SIZE_IN_WORDS) 273 else if (words > I40E_SR_SECTOR_SIZE_IN_WORDS)
268 /* We can write only up to 4KB (one sector), in one AQ write */ 274 /* We can write only up to 4KB (one sector), in one AQ write */
269 hw_dbg(hw, "NVM write fail error: cannot write more than 4KB in a single write.\n"); 275 i40e_debug(hw, I40E_DEBUG_NVM,
276 "NVM write fail error: tried to write %d words, limit is %d.\n",
277 words, I40E_SR_SECTOR_SIZE_IN_WORDS);
270 else if (((offset + (words - 1)) / I40E_SR_SECTOR_SIZE_IN_WORDS) 278 else if (((offset + (words - 1)) / I40E_SR_SECTOR_SIZE_IN_WORDS)
271 != (offset / I40E_SR_SECTOR_SIZE_IN_WORDS)) 279 != (offset / I40E_SR_SECTOR_SIZE_IN_WORDS))
272 /* A single write cannot spread over two sectors */ 280 /* A single write cannot spread over two sectors */
273 hw_dbg(hw, "NVM write error: cannot spread over two sectors in a single write.\n"); 281 i40e_debug(hw, I40E_DEBUG_NVM,
282 "NVM write error: cannot spread over two sectors in a single write offset=%d words=%d\n",
283 offset, words);
274 else 284 else
275 ret_code = i40e_aq_update_nvm(hw, module_pointer, 285 ret_code = i40e_aq_update_nvm(hw, module_pointer,
276 2 * offset, /*bytes*/ 286 2 * offset, /*bytes*/
@@ -438,6 +448,22 @@ static inline u8 i40e_nvmupd_get_transaction(u32 val)
438 return (u8)((val & I40E_NVM_TRANS_MASK) >> I40E_NVM_TRANS_SHIFT); 448 return (u8)((val & I40E_NVM_TRANS_MASK) >> I40E_NVM_TRANS_SHIFT);
439} 449}
440 450
451static char *i40e_nvm_update_state_str[] = {
452 "I40E_NVMUPD_INVALID",
453 "I40E_NVMUPD_READ_CON",
454 "I40E_NVMUPD_READ_SNT",
455 "I40E_NVMUPD_READ_LCB",
456 "I40E_NVMUPD_READ_SA",
457 "I40E_NVMUPD_WRITE_ERA",
458 "I40E_NVMUPD_WRITE_CON",
459 "I40E_NVMUPD_WRITE_SNT",
460 "I40E_NVMUPD_WRITE_LCB",
461 "I40E_NVMUPD_WRITE_SA",
462 "I40E_NVMUPD_CSUM_CON",
463 "I40E_NVMUPD_CSUM_SA",
464 "I40E_NVMUPD_CSUM_LCB",
465};
466
441/** 467/**
442 * i40e_nvmupd_command - Process an NVM update command 468 * i40e_nvmupd_command - Process an NVM update command
443 * @hw: pointer to hardware structure 469 * @hw: pointer to hardware structure
@@ -471,6 +497,8 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
471 497
472 default: 498 default:
473 /* invalid state, should never happen */ 499 /* invalid state, should never happen */
500 i40e_debug(hw, I40E_DEBUG_NVM,
501 "NVMUPD: no such state %d\n", hw->nvmupd_state);
474 status = I40E_NOT_SUPPORTED; 502 status = I40E_NOT_SUPPORTED;
475 *errno = -ESRCH; 503 *errno = -ESRCH;
476 break; 504 break;
@@ -572,6 +600,9 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
572 break; 600 break;
573 601
574 default: 602 default:
603 i40e_debug(hw, I40E_DEBUG_NVM,
604 "NVMUPD: bad cmd %s in init state\n",
605 i40e_nvm_update_state_str[upd_cmd]);
575 status = I40E_ERR_NVM; 606 status = I40E_ERR_NVM;
576 *errno = -ESRCH; 607 *errno = -ESRCH;
577 break; 608 break;
@@ -611,6 +642,9 @@ static i40e_status i40e_nvmupd_state_reading(struct i40e_hw *hw,
611 break; 642 break;
612 643
613 default: 644 default:
645 i40e_debug(hw, I40E_DEBUG_NVM,
646 "NVMUPD: bad cmd %s in reading state.\n",
647 i40e_nvm_update_state_str[upd_cmd]);
614 status = I40E_NOT_SUPPORTED; 648 status = I40E_NOT_SUPPORTED;
615 *errno = -ESRCH; 649 *errno = -ESRCH;
616 break; 650 break;
@@ -671,6 +705,9 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw,
671 break; 705 break;
672 706
673 default: 707 default:
708 i40e_debug(hw, I40E_DEBUG_NVM,
709 "NVMUPD: bad cmd %s in writing state.\n",
710 i40e_nvm_update_state_str[upd_cmd]);
674 status = I40E_NOT_SUPPORTED; 711 status = I40E_NOT_SUPPORTED;
675 *errno = -ESRCH; 712 *errno = -ESRCH;
676 break; 713 break;
@@ -702,8 +739,9 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
702 /* limits on data size */ 739 /* limits on data size */
703 if ((cmd->data_size < 1) || 740 if ((cmd->data_size < 1) ||
704 (cmd->data_size > I40E_NVMUPD_MAX_DATA)) { 741 (cmd->data_size > I40E_NVMUPD_MAX_DATA)) {
705 hw_dbg(hw, "i40e_nvmupd_validate_command data_size %d\n", 742 i40e_debug(hw, I40E_DEBUG_NVM,
706 cmd->data_size); 743 "i40e_nvmupd_validate_command data_size %d\n",
744 cmd->data_size);
707 *errno = -EFAULT; 745 *errno = -EFAULT;
708 return I40E_NVMUPD_INVALID; 746 return I40E_NVMUPD_INVALID;
709 } 747 }
@@ -755,12 +793,14 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
755 } 793 }
756 break; 794 break;
757 } 795 }
796 i40e_debug(hw, I40E_DEBUG_NVM, "%s\n",
797 i40e_nvm_update_state_str[upd_cmd]);
758 798
759 if (upd_cmd == I40E_NVMUPD_INVALID) { 799 if (upd_cmd == I40E_NVMUPD_INVALID) {
760 *errno = -EFAULT; 800 *errno = -EFAULT;
761 hw_dbg(hw, 801 i40e_debug(hw, I40E_DEBUG_NVM,
762 "i40e_nvmupd_validate_command returns %d errno: %d\n", 802 "i40e_nvmupd_validate_command returns %d errno %d\n",
763 upd_cmd, *errno); 803 upd_cmd, *errno);
764 } 804 }
765 return upd_cmd; 805 return upd_cmd;
766} 806}
@@ -785,14 +825,18 @@ static i40e_status i40e_nvmupd_nvm_read(struct i40e_hw *hw,
785 transaction = i40e_nvmupd_get_transaction(cmd->config); 825 transaction = i40e_nvmupd_get_transaction(cmd->config);
786 module = i40e_nvmupd_get_module(cmd->config); 826 module = i40e_nvmupd_get_module(cmd->config);
787 last = (transaction == I40E_NVM_LCB) || (transaction == I40E_NVM_SA); 827 last = (transaction == I40E_NVM_LCB) || (transaction == I40E_NVM_SA);
788 hw_dbg(hw, "i40e_nvmupd_nvm_read mod 0x%x off 0x%x len 0x%x\n",
789 module, cmd->offset, cmd->data_size);
790 828
791 status = i40e_aq_read_nvm(hw, module, cmd->offset, (u16)cmd->data_size, 829 status = i40e_aq_read_nvm(hw, module, cmd->offset, (u16)cmd->data_size,
792 bytes, last, NULL); 830 bytes, last, NULL);
793 hw_dbg(hw, "i40e_nvmupd_nvm_read status %d\n", status); 831 if (status) {
794 if (status) 832 i40e_debug(hw, I40E_DEBUG_NVM,
833 "i40e_nvmupd_nvm_read mod 0x%x off 0x%x len 0x%x\n",
834 module, cmd->offset, cmd->data_size);
835 i40e_debug(hw, I40E_DEBUG_NVM,
836 "i40e_nvmupd_nvm_read status %d aq %d\n",
837 status, hw->aq.asq_last_status);
795 *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status); 838 *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
839 }
796 840
797 return status; 841 return status;
798} 842}
@@ -816,13 +860,17 @@ static i40e_status i40e_nvmupd_nvm_erase(struct i40e_hw *hw,
816 transaction = i40e_nvmupd_get_transaction(cmd->config); 860 transaction = i40e_nvmupd_get_transaction(cmd->config);
817 module = i40e_nvmupd_get_module(cmd->config); 861 module = i40e_nvmupd_get_module(cmd->config);
818 last = (transaction & I40E_NVM_LCB); 862 last = (transaction & I40E_NVM_LCB);
819 hw_dbg(hw, "i40e_nvmupd_nvm_erase mod 0x%x off 0x%x len 0x%x\n",
820 module, cmd->offset, cmd->data_size);
821 status = i40e_aq_erase_nvm(hw, module, cmd->offset, (u16)cmd->data_size, 863 status = i40e_aq_erase_nvm(hw, module, cmd->offset, (u16)cmd->data_size,
822 last, NULL); 864 last, NULL);
823 hw_dbg(hw, "i40e_nvmupd_nvm_erase status %d\n", status); 865 if (status) {
824 if (status) 866 i40e_debug(hw, I40E_DEBUG_NVM,
867 "i40e_nvmupd_nvm_erase mod 0x%x off 0x%x len 0x%x\n",
868 module, cmd->offset, cmd->data_size);
869 i40e_debug(hw, I40E_DEBUG_NVM,
870 "i40e_nvmupd_nvm_erase status %d aq %d\n",
871 status, hw->aq.asq_last_status);
825 *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status); 872 *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
873 }
826 874
827 return status; 875 return status;
828} 876}
@@ -847,13 +895,18 @@ static i40e_status i40e_nvmupd_nvm_write(struct i40e_hw *hw,
847 transaction = i40e_nvmupd_get_transaction(cmd->config); 895 transaction = i40e_nvmupd_get_transaction(cmd->config);
848 module = i40e_nvmupd_get_module(cmd->config); 896 module = i40e_nvmupd_get_module(cmd->config);
849 last = (transaction & I40E_NVM_LCB); 897 last = (transaction & I40E_NVM_LCB);
850 hw_dbg(hw, "i40e_nvmupd_nvm_write mod 0x%x off 0x%x len 0x%x\n", 898
851 module, cmd->offset, cmd->data_size);
852 status = i40e_aq_update_nvm(hw, module, cmd->offset, 899 status = i40e_aq_update_nvm(hw, module, cmd->offset,
853 (u16)cmd->data_size, bytes, last, NULL); 900 (u16)cmd->data_size, bytes, last, NULL);
854 hw_dbg(hw, "i40e_nvmupd_nvm_write status %d\n", status); 901 if (status) {
855 if (status) 902 i40e_debug(hw, I40E_DEBUG_NVM,
903 "i40e_nvmupd_nvm_write mod 0x%x off 0x%x len 0x%x\n",
904 module, cmd->offset, cmd->data_size);
905 i40e_debug(hw, I40E_DEBUG_NVM,
906 "i40e_nvmupd_nvm_write status %d aq %d\n",
907 status, hw->aq.asq_last_status);
856 *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status); 908 *errno = i40e_aq_rc_to_posix(hw->aq.asq_last_status);
909 }
857 910
858 return status; 911 return status;
859} 912}