Commit e6f3f120 authored by David S. Miller's avatar David S. Miller

Merge branch 'qed-debug-data-collection'

Tomer Tayar says:

====================
qed*: Debug data collection

This patch series adds the support of debug data collection in the qed driver,
and the means to extract it in the qede driver via the get_regs operation.

Changes from V1:
- Respin of the series after rebasing next-next.
- Remove the first patch as it seems that its V1 version was already applied
  (commit '4102426f').
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 936f0600 e0971c83
...@@ -2,5 +2,5 @@ obj-$(CONFIG_QED) := qed.o ...@@ -2,5 +2,5 @@ obj-$(CONFIG_QED) := qed.o
qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o qed_init_ops.o \ qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o qed_init_ops.o \
qed_int.o qed_main.o qed_mcp.o qed_sp_commands.o qed_spq.o qed_l2.o \ qed_int.o qed_main.o qed_mcp.o qed_sp_commands.o qed_spq.o qed_l2.o \
qed_selftest.o qed_dcbx.o qed_selftest.o qed_dcbx.o qed_debug.o
qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/zlib.h> #include <linux/zlib.h>
#include <linux/hashtable.h> #include <linux/hashtable.h>
#include <linux/qed/qed_if.h> #include <linux/qed/qed_if.h>
#include "qed_debug.h"
#include "qed_hsi.h" #include "qed_hsi.h"
extern const struct qed_common_ops qed_common_ops_pass; extern const struct qed_common_ops qed_common_ops_pass;
...@@ -395,6 +396,8 @@ struct qed_hwfn { ...@@ -395,6 +396,8 @@ struct qed_hwfn {
/* Buffer for unzipping firmware data */ /* Buffer for unzipping firmware data */
void *unzip_buf; void *unzip_buf;
struct dbg_tools_data dbg_info;
struct qed_simd_fp_handler simd_proto_handler[64]; struct qed_simd_fp_handler simd_proto_handler[64];
#ifdef CONFIG_QED_SRIOV #ifdef CONFIG_QED_SRIOV
...@@ -430,6 +433,19 @@ struct qed_int_params { ...@@ -430,6 +433,19 @@ struct qed_int_params {
u8 fp_msix_cnt; u8 fp_msix_cnt;
}; };
struct qed_dbg_feature {
struct dentry *dentry;
u8 *dump_buf;
u32 buf_size;
u32 dumped_dwords;
};
struct qed_dbg_params {
struct qed_dbg_feature features[DBG_FEATURE_NUM];
u8 engine_for_debug;
bool print_data;
};
struct qed_dev { struct qed_dev {
u32 dp_module; u32 dp_module;
u8 dp_level; u8 dp_level;
...@@ -444,6 +460,8 @@ struct qed_dev { ...@@ -444,6 +460,8 @@ struct qed_dev {
CHIP_REV_IS_A0(dev)) CHIP_REV_IS_A0(dev))
#define QED_IS_BB_B0(dev) (QED_IS_BB(dev) && \ #define QED_IS_BB_B0(dev) (QED_IS_BB(dev) && \
CHIP_REV_IS_B0(dev)) CHIP_REV_IS_B0(dev))
#define QED_IS_AH(dev) ((dev)->type == QED_DEV_TYPE_AH)
#define QED_IS_K2(dev) QED_IS_AH(dev)
#define QED_GET_TYPE(dev) (QED_IS_BB_A0(dev) ? CHIP_BB_A0 : \ #define QED_GET_TYPE(dev) (QED_IS_BB_A0(dev) ? CHIP_BB_A0 : \
QED_IS_BB_B0(dev) ? CHIP_BB_B0 : CHIP_K2) QED_IS_BB_B0(dev) ? CHIP_BB_B0 : CHIP_K2)
...@@ -544,6 +562,8 @@ struct qed_dev { ...@@ -544,6 +562,8 @@ struct qed_dev {
} protocol_ops; } protocol_ops;
void *ops_cookie; void *ops_cookie;
struct qed_dbg_params dbg_params;
const struct firmware *firmware; const struct firmware *firmware;
}; };
......
This diff is collapsed.
/* QLogic qed NIC Driver
* Copyright (c) 2015 QLogic Corporation
*
* This software is available under the terms of the GNU General Public License
* (GPL) Version 2, available from the file COPYING in the main directory of
* this source tree.
*/
#ifndef _QED_DEBUGFS_H
#define _QED_DEBUGFS_H
enum qed_dbg_features {
DBG_FEATURE_GRC,
DBG_FEATURE_IDLE_CHK,
DBG_FEATURE_MCP_TRACE,
DBG_FEATURE_REG_FIFO,
DBG_FEATURE_IGU_FIFO,
DBG_FEATURE_PROTECTION_OVERRIDE,
DBG_FEATURE_FW_ASSERTS,
DBG_FEATURE_NUM
};
int qed_dbg_grc(struct qed_dev *cdev, void *buffer, u32 *num_dumped_bytes);
int qed_dbg_grc_size(struct qed_dev *cdev);
int qed_dbg_idle_chk(struct qed_dev *cdev, void *buffer,
u32 *num_dumped_bytes);
int qed_dbg_idle_chk_size(struct qed_dev *cdev);
int qed_dbg_reg_fifo(struct qed_dev *cdev, void *buffer,
u32 *num_dumped_bytes);
int qed_dbg_reg_fifo_size(struct qed_dev *cdev);
int qed_dbg_igu_fifo(struct qed_dev *cdev, void *buffer,
u32 *num_dumped_bytes);
int qed_dbg_igu_fifo_size(struct qed_dev *cdev);
int qed_dbg_protection_override(struct qed_dev *cdev, void *buffer,
u32 *num_dumped_bytes);
int qed_dbg_protection_override_size(struct qed_dev *cdev);
int qed_dbg_fw_asserts(struct qed_dev *cdev, void *buffer,
u32 *num_dumped_bytes);
int qed_dbg_fw_asserts_size(struct qed_dev *cdev);
int qed_dbg_mcp_trace(struct qed_dev *cdev, void *buffer,
u32 *num_dumped_bytes);
int qed_dbg_mcp_trace_size(struct qed_dev *cdev);
int qed_dbg_all_data(struct qed_dev *cdev, void *buffer);
int qed_dbg_all_data_size(struct qed_dev *cdev);
u8 qed_get_debug_engine(struct qed_dev *cdev);
void qed_set_debug_engine(struct qed_dev *cdev, int engine_number);
int qed_dbg_feature(struct qed_dev *cdev, void *buffer,
enum qed_dbg_features feature, u32 *num_dumped_bytes);
int qed_dbg_feature_size(struct qed_dev *cdev, enum qed_dbg_features feature);
void qed_dbg_pf_init(struct qed_dev *cdev);
void qed_dbg_pf_exit(struct qed_dev *cdev);
#endif
This diff is collapsed.
...@@ -588,6 +588,8 @@ static int qed_nic_stop(struct qed_dev *cdev) ...@@ -588,6 +588,8 @@ static int qed_nic_stop(struct qed_dev *cdev)
} }
} }
qed_dbg_pf_exit(cdev);
return rc; return rc;
} }
...@@ -846,6 +848,8 @@ static int qed_slowpath_start(struct qed_dev *cdev, ...@@ -846,6 +848,8 @@ static int qed_slowpath_start(struct qed_dev *cdev,
/* First Dword used to diffrentiate between various sources */ /* First Dword used to diffrentiate between various sources */
data = cdev->firmware->data + sizeof(u32); data = cdev->firmware->data + sizeof(u32);
qed_dbg_pf_init(cdev);
} }
memset(&tunn_info, 0, sizeof(tunn_info)); memset(&tunn_info, 0, sizeof(tunn_info));
...@@ -1394,6 +1398,8 @@ const struct qed_common_ops qed_common_ops_pass = { ...@@ -1394,6 +1398,8 @@ const struct qed_common_ops qed_common_ops_pass = {
.get_link = &qed_get_current_link, .get_link = &qed_get_current_link,
.drain = &qed_drain, .drain = &qed_drain,
.update_msglvl = &qed_init_dp, .update_msglvl = &qed_init_dp,
.dbg_all_data = &qed_dbg_all_data,
.dbg_all_data_size = &qed_dbg_all_data_size,
.chain_alloc = &qed_chain_alloc, .chain_alloc = &qed_chain_alloc,
.chain_free = &qed_chain_free, .chain_free = &qed_chain_free,
.get_coalesce = &qed_get_coalesce, .get_coalesce = &qed_get_coalesce,
......
...@@ -695,6 +695,28 @@ static int qede_set_pauseparam(struct net_device *dev, ...@@ -695,6 +695,28 @@ static int qede_set_pauseparam(struct net_device *dev,
return 0; return 0;
} }
static void qede_get_regs(struct net_device *ndev,
struct ethtool_regs *regs, void *buffer)
{
struct qede_dev *edev = netdev_priv(ndev);
regs->version = 0;
memset(buffer, 0, regs->len);
if (edev->ops && edev->ops->common)
edev->ops->common->dbg_all_data(edev->cdev, buffer);
}
static int qede_get_regs_len(struct net_device *ndev)
{
struct qede_dev *edev = netdev_priv(ndev);
if (edev->ops && edev->ops->common)
return edev->ops->common->dbg_all_data_size(edev->cdev);
else
return -EINVAL;
}
static void qede_update_mtu(struct qede_dev *edev, union qede_reload_args *args) static void qede_update_mtu(struct qede_dev *edev, union qede_reload_args *args)
{ {
edev->ndev->mtu = args->mtu; edev->ndev->mtu = args->mtu;
...@@ -1395,6 +1417,8 @@ static const struct ethtool_ops qede_ethtool_ops = { ...@@ -1395,6 +1417,8 @@ static const struct ethtool_ops qede_ethtool_ops = {
.get_link_ksettings = qede_get_link_ksettings, .get_link_ksettings = qede_get_link_ksettings,
.set_link_ksettings = qede_set_link_ksettings, .set_link_ksettings = qede_set_link_ksettings,
.get_drvinfo = qede_get_drvinfo, .get_drvinfo = qede_get_drvinfo,
.get_regs_len = qede_get_regs_len,
.get_regs = qede_get_regs,
.get_msglevel = qede_get_msglevel, .get_msglevel = qede_get_msglevel,
.set_msglevel = qede_set_msglevel, .set_msglevel = qede_set_msglevel,
.nway_reset = qede_nway_reset, .nway_reset = qede_nway_reset,
......
...@@ -143,6 +143,9 @@ ...@@ -143,6 +143,9 @@
#define GTT_BYTE_SIZE_BITS (GTT_DWORD_SIZE_BITS + 2) #define GTT_BYTE_SIZE_BITS (GTT_DWORD_SIZE_BITS + 2)
#define GTT_DWORD_SIZE BIT(GTT_DWORD_SIZE_BITS) #define GTT_DWORD_SIZE BIT(GTT_DWORD_SIZE_BITS)
/* Tools Version */
#define TOOLS_VERSION 10
/*****************/ /*****************/
/* CDU CONSTANTS */ /* CDU CONSTANTS */
/*****************/ /*****************/
......
...@@ -455,6 +455,10 @@ struct qed_common_ops { ...@@ -455,6 +455,10 @@ struct qed_common_ops {
void (*simd_handler_clean)(struct qed_dev *cdev, void (*simd_handler_clean)(struct qed_dev *cdev,
int index); int index);
int (*dbg_all_data) (struct qed_dev *cdev, void *buffer);
int (*dbg_all_data_size) (struct qed_dev *cdev);
/** /**
* @brief can_link_change - can the instance change the link or not * @brief can_link_change - can the instance change the link or not
* *
......
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