i40e: add tracepoints for nvmupdate troubleshooting
Subsystems (2)
PATCH v4 1/1 i40e: add tracepoints for nvmupdate troubleshooting
Improve nvmupdate troubleshooting with bpftrace utility.
Add 'stable' static tracepoints to decode nvmupdate commands compatible even for future driver versions.
Remove 'static' from eeprom functions declarations, make them public to enable dynamic kernel tracing and profiling.
Example:
echo "i40e_*" >/sys/kernel/tracing/set_ftrace_filter echo "i40e_*" >/sys/kernel/tracing/events/i40e/filter echo 1 >/sys/kernel/tracing/tracing_on echo 1 >/sys/kernel/tracing/events/i40e/enable
...
cat /sys/kernel/tracing/trace
Signed-off-by Aleksandr Loktionov <[email protected]>
---v3->v4 fix clang warning about uninitialized use of ret v2->v3 apply on dev-queue branch
---
--- drivers/net/ethernet/intel/i40e/i40e.h | 5 + .../net/ethernet/intel/i40e/i40e_ethtool.c | 30 ++- drivers/net/ethernet/intel/i40e/i40e_main.c | 22 +- drivers/net/ethernet/intel/i40e/i40e_trace.h | 212 ++++++++++++++++++ 4 files changed, 257 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +5 -0
@@ -1170,6 +1170,11 @@ u32 i40e_get_current_atr_cnt(struct i40e_pf *pf);u32 i40e_get_global_fd_count (struct i40e_pf *pf);bool i40e_set_ntuple (struct i40e_pf *pf,netdev_features_t features);void i40e_set_ethtool_ops (struct net_device *netdev); +int i40e_get_eeprom (struct net_device *netdev, +struct ethtool_eeprom *eeprom,u8 *bytes); +int i40e_get_eeprom_len (struct net_device *netdev); +int i40e_set_eeprom (struct net_device *netdev, +struct ethtool_eeprom *eeprom,u8 *bytes);struct i40e_mac_filter *i40e_add_filter (struct i40e_vsi *vsi,const u8 *macaddr,s16 vlan);void __i40e_del_filter (struct i40e_vsi *vsi,struct i40e_mac_filter *f);
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +21 -9
@@ -4,6 +4,7 @@/* ethtool support for i40e */ #include "i40e.h" +#include "i40e_trace.h" #include "i40e_diag.h" #include "i40e_txrx_common.h"
@@ -1848,8 +1849,8 @@ static void i40e_get_regs(struct net_device *netdev, struct ethtool_regs *regs, } -static int i40e_get_eeprom (struct net_device *netdev, -struct ethtool_eeprom *eeprom,u8 *bytes) +int i40e_get_eeprom (struct net_device *netdev, +struct ethtool_eeprom *eeprom,u8 *bytes) {struct i40e_netdev_priv *np =netdev_priv (netdev);struct i40e_hw *hw = &np->vsi->back->hw;
@@ -1860,6 +1861,8 @@ static int i40e_get_eeprom(struct net_device *netdev,bool last;u32 magic; +i40e_trace (ioctl_get_eeprom, pf, ((u64 )eeprom->offset <<32 ) | + eeprom->len);#define I40E_NVM_SECTOR_SIZE 4096if (eeprom->len ==0 )return -EINVAL ;
@@ -1874,10 +1877,12 @@ static int i40e_get_eeprom(struct net_device *netdev,if ((eeprom->magic >>16 ) != hw->device_id) errno = -EINVAL ;else if (test_bit (__I40E_RESET_RECOVERY_PENDING, pf->state) || -test_bit (__I40E_RESET_INTR_RECEIVED, pf->state)) +test_bit (__I40E_RESET_INTR_RECEIVED, pf->state)) { errno = -EBUSY ; -else + }else { ret_val =i40e_nvmupd_command (hw, cmd, bytes, &errno); +i40e_trace (nvmupd_read, hw, cmd, ret_val, errno); + }if ((errno || ret_val) && (hw->debug_mask &I40E_DEBUG_NVM )) dev_info(&pf->pdev->dev,
@@ -1943,7 +1948,7 @@ static int i40e_get_eeprom(struct net_device *netdev,return ret_val; } -static int i40e_get_eeprom_len (struct net_device *netdev) +int i40e_get_eeprom_len (struct net_device *netdev) {struct i40e_netdev_priv *np =netdev_priv (netdev);struct i40e_hw *hw = &np->vsi->back->hw;
@@ -1952,6 +1957,7 @@ static int i40e_get_eeprom_len(struct net_device *netdev)#define X722_EEPROM_SCOPE_LIMIT 0x5B9FFFif (hw->mac.type ==I40E_MAC_X722 ) { val =X722_EEPROM_SCOPE_LIMIT +1 ; +i40e_trace (ioctl_get_eeprom_len, np->vsi->back, val);return val; } val = (rd32(hw, I40E_GLPCI_LBARCTRL)
@@ -1959,11 +1965,12 @@ static int i40e_get_eeprom_len(struct net_device *netdev) >> I40E_GLPCI_LBARCTRL_FL_SIZE_SHIFT;/* register returns value in power of 2, 64Kbyte chunks. */ val = (64 *1024 ) *BIT (val); +i40e_trace (ioctl_get_eeprom_len, np->vsi->back, val);return val; } -static int i40e_set_eeprom (struct net_device *netdev, -struct ethtool_eeprom *eeprom,u8 *bytes) +int i40e_set_eeprom (struct net_device *netdev, +struct ethtool_eeprom *eeprom,u8 *bytes) {struct i40e_netdev_priv *np =netdev_priv (netdev);struct i40e_hw *hw = &np->vsi->back->hw;
@@ -1973,6 +1980,8 @@ static int i40e_set_eeprom(struct net_device *netdev,int errno =0 ;u32 magic; +i40e_trace (ioctl_set_eeprom, pf, ((u64 )eeprom->offset <<32 ) | + eeprom->len);/* normal ethtool set_eeprom is not supported */ magic = hw->vendor_id | (hw->device_id <<16 );if (eeprom->magic == magic)
@@ -1981,10 +1990,12 @@ static int i40e_set_eeprom(struct net_device *netdev,else if (!eeprom->magic || (eeprom->magic >>16 ) != hw->device_id) errno = -EINVAL ;else if (test_bit (__I40E_RESET_RECOVERY_PENDING, pf->state) || -test_bit (__I40E_RESET_INTR_RECEIVED, pf->state)) +test_bit (__I40E_RESET_INTR_RECEIVED, pf->state)) { errno = -EBUSY ; -else + }else { ret_val =i40e_nvmupd_command (hw, cmd, bytes, &errno); +i40e_trace (nvmupd_write, hw, cmd, ret_val, errno); + }if ((errno || ret_val) && (hw->debug_mask &I40E_DEBUG_NVM )) dev_info(&pf->pdev->dev,
@@ -2011,6 +2022,7 @@ static void i40e_get_drvinfo(struct net_device *netdev, drvinfo->n_priv_flags =I40E_PRIV_FLAGS_STR_LEN ;if (pf->hw.pf_id ==0 ) drvinfo->n_priv_flags +=I40E_GL_PRIV_FLAGS_STR_LEN ; +i40e_trace (ioctl_get_drvinfo, pf, drvinfo->n_priv_flags); } static void i40e_get_ringparam(struct net_device *netdev,
drivers/net/ethernet/intel/i40e/i40e_main.c +19 -3
@@ -4332,20 +4332,27 @@ static irqreturn_t i40e_intr(int irq, void *data) >> I40E_GLGEN_RSTAT_RESET_TYPE_SHIFT;if (val ==I40E_RESET_CORER ) { pf->corer_count++; +i40e_trace (state_reset_corer, pf, pf->corer_count); }else if (val ==I40E_RESET_GLOBR ) { pf->globr_count++; +i40e_trace (state_reset_globr, pf, pf->globr_count); }else if (val ==I40E_RESET_EMPR ) { pf->empr_count++;set_bit (__I40E_EMP_RESET_INTR_RECEIVED, pf->state); +i40e_trace (state_reset_empr, pf, pf->empr_count); } }if (icr0 &I40E_PFINT_ICR0_HMC_ERR_MASK ) { +const u32 err_info =rd32 (hw,I40E_PFHMC_ERRORINFO ); +const u32 err_data =rd32 (hw,I40E_PFHMC_ERRORDATA ); + icr0 &= ~I40E_PFINT_ICR0_HMC_ERR_MASK ; +i40e_trace (state_hmc_error, pf, + ((u64 )err_info <<32 ) | err_data);dev_info (&pf->pdev->dev,"HMC error interrupt\n" );dev_info (&pf->pdev->dev,"HMC error info 0x%x, HMC error data 0x%x\n" , -rd32 (hw,I40E_PFHMC_ERRORINFO ), -rd32 (hw,I40E_PFHMC_ERRORDATA )); + err_info, err_data); }if (icr0 &I40E_PFINT_ICR0_TIMESYNC_MASK ) {
@@ -9909,11 +9916,13 @@ static void i40e_link_event(struct i40e_pf *pf)/* On success, disable temp link polling */ if (status ==0 ) {clear_bit (__I40E_TEMP_LINK_POLLING, pf->state); +i40e_trace (state_link, pf, pf->hw.phy.link_info.link_speed); }else {/* Enable link polling temporarily until i40e_get_link_status * returns 0 */ set_bit (__I40E_TEMP_LINK_POLLING, pf->state); +i40e_trace (state_link, pf, pf->hw.phy.link_info.link_speed);dev_dbg (&pf->pdev->dev,"couldn't get link state, status: %d\n" , status);return ;
@@ -9988,6 +9997,7 @@ static void i40e_watchdog_subtask(struct i40e_pf *pf) pf->service_timer_period)))return ; pf->service_timer_previous = jiffies; +i40e_trace (state_watchdog, pf, pf->service_timer_previous);if ((pf->flags &I40E_FLAG_LINK_POLLING_ENABLED ) ||test_bit (__I40E_TEMP_LINK_POLLING, pf->state))
@@ -10040,6 +10050,8 @@ static void i40e_reset_subtask(struct i40e_pf *pf)rtnl_lock (); +i40e_trace (state_reset, pf, reset_flags); +/* If there's a recovery already waiting, it takes * precedence before starting a new reset sequence. */
@@ -10120,6 +10132,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)/* check for error indications */ val =rd32 (&pf->hw, pf->hw.aq.arq.len); +i40e_trace (state_arq, pf, val); oldval = val;if (val &I40E_PF_ARQLEN_ARQVFE_MASK ) {if (hw->debug_mask &I40E_DEBUG_AQ )
@@ -10141,6 +10154,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)wr32 (&pf->hw, pf->hw.aq.arq.len, val); val =rd32 (&pf->hw, pf->hw.aq.asq.len); +i40e_trace (state_asq, pf, val); oldval = val;if (val &I40E_PF_ATQLEN_ATQVFE_MASK ) {if (pf->hw.debug_mask &I40E_DEBUG_AQ )
@@ -10830,7 +10844,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)const bool is_recovery_mode_reported =i40e_check_recovery_mode (pf);struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];struct i40e_hw *hw = &pf->hw; -int ret; +int ret =EBADE ;u32 val;int v;
@@ -11113,6 +11127,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) end_core_reset:clear_bit (__I40E_RESET_FAILED, pf->state); clear_recovery: +i40e_trace (state_rebuild, pf, ret);clear_bit (__I40E_RESET_RECOVERY_PENDING, pf->state);clear_bit (__I40E_TIMEOUT_RECOVERY_PENDING, pf->state); }
@@ -15431,6 +15446,7 @@ static bool i40e_check_recovery_mode(struct i40e_pf *pf)dev_crit (&pf->pdev->dev,"Firmware recovery mode detected. Limiting functionality.\n" );dev_crit (&pf->pdev->dev,"Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n" );set_bit (__I40E_RECOVERY_MODE, pf->state); +i40e_trace (state_recovery, pf, val);return true; }
drivers/net/ethernet/intel/i40e/i40e_trace.h +212 -0
218 lines not on this page · raw message
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan