Commit 7e9979e3 authored by Prabhakar Kushwaha's avatar Prabhakar Kushwaha Committed by David S. Miller

qed: Enhance rammod debug prints to provide pretty details

Instead of printing numbers of protocol IDs and rammod commands,
enhance debug prints to provide names. s_protocol_types[] and
s_ramrod_cmd_ids arrays[] are added to support along with APIs.
Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
Signed-off-by: default avatarAlok Prasad <palok@marvell.com>
Signed-off-by: default avatarPrabhakar Kushwaha <pkushwaha@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a290cf69
...@@ -2720,6 +2720,25 @@ void qed_memset_task_ctx(void *p_ctx_mem, u32 ctx_size, u8 ctx_type); ...@@ -2720,6 +2720,25 @@ void qed_memset_task_ctx(void *p_ctx_mem, u32 ctx_size, u8 ctx_type);
#define NUM_STORMS 6 #define NUM_STORMS 6
/**
* qed_get_protocol_type_str(): Get a string for Protocol type.
*
* @protocol_type: Protocol type (using enum protocol_type).
*
* Return: String.
*/
const char *qed_get_protocol_type_str(u32 protocol_type);
/**
* qed_get_ramrod_cmd_id_str(): Get a string for Ramrod command ID.
*
* @protocol_type: Protocol type (using enum protocol_type).
* @ramrod_cmd_id: Ramrod command ID (using per-protocol enum <protocol>_ramrod_cmd_id).
*
* Return: String.
*/
const char *qed_get_ramrod_cmd_id_str(u32 protocol_type, u32 ramrod_cmd_id);
/** /**
* qed_set_rdma_error_level(): Sets the RDMA assert level. * qed_set_rdma_error_level(): Sets the RDMA assert level.
* If the severity of the error will be * If the severity of the error will be
......
...@@ -210,6 +210,82 @@ static u16 task_region_offsets[1][NUM_OF_CONNECTION_TYPES] = { ...@@ -210,6 +210,82 @@ static u16 task_region_offsets[1][NUM_OF_CONNECTION_TYPES] = {
(XSEM_REG_FAST_MEMORY + SEM_FAST_REG_INT_RAM + \ (XSEM_REG_FAST_MEMORY + SEM_FAST_REG_INT_RAM + \
XSTORM_PQ_INFO_OFFSET(pq_id)) XSTORM_PQ_INFO_OFFSET(pq_id))
static const char * const s_protocol_types[] = {
"PROTOCOLID_ISCSI", "PROTOCOLID_FCOE", "PROTOCOLID_ROCE",
"PROTOCOLID_CORE", "PROTOCOLID_ETH", "PROTOCOLID_IWARP",
"PROTOCOLID_TOE", "PROTOCOLID_PREROCE", "PROTOCOLID_COMMON",
"PROTOCOLID_TCP", "PROTOCOLID_RDMA", "PROTOCOLID_SCSI",
};
static const char *s_ramrod_cmd_ids[][28] = {
{
"ISCSI_RAMROD_CMD_ID_UNUSED", "ISCSI_RAMROD_CMD_ID_INIT_FUNC",
"ISCSI_RAMROD_CMD_ID_DESTROY_FUNC",
"ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN",
"ISCSI_RAMROD_CMD_ID_UPDATE_CONN",
"ISCSI_RAMROD_CMD_ID_TERMINATION_CONN",
"ISCSI_RAMROD_CMD_ID_CLEAR_SQ", "ISCSI_RAMROD_CMD_ID_MAC_UPDATE",
"ISCSI_RAMROD_CMD_ID_CONN_STATS", },
{ "FCOE_RAMROD_CMD_ID_INIT_FUNC", "FCOE_RAMROD_CMD_ID_DESTROY_FUNC",
"FCOE_RAMROD_CMD_ID_STAT_FUNC",
"FCOE_RAMROD_CMD_ID_OFFLOAD_CONN",
"FCOE_RAMROD_CMD_ID_TERMINATE_CONN", },
{ "RDMA_RAMROD_UNUSED", "RDMA_RAMROD_FUNC_INIT",
"RDMA_RAMROD_FUNC_CLOSE", "RDMA_RAMROD_REGISTER_MR",
"RDMA_RAMROD_DEREGISTER_MR", "RDMA_RAMROD_CREATE_CQ",
"RDMA_RAMROD_RESIZE_CQ", "RDMA_RAMROD_DESTROY_CQ",
"RDMA_RAMROD_CREATE_SRQ", "RDMA_RAMROD_MODIFY_SRQ",
"RDMA_RAMROD_DESTROY_SRQ", "RDMA_RAMROD_START_NS_TRACKING",
"RDMA_RAMROD_STOP_NS_TRACKING", "ROCE_RAMROD_CREATE_QP",
"ROCE_RAMROD_MODIFY_QP", "ROCE_RAMROD_QUERY_QP",
"ROCE_RAMROD_DESTROY_QP", "ROCE_RAMROD_CREATE_UD_QP",
"ROCE_RAMROD_DESTROY_UD_QP", "ROCE_RAMROD_FUNC_UPDATE",
"ROCE_RAMROD_SUSPEND_QP", "ROCE_RAMROD_QUERY_SUSPENDED_QP",
"ROCE_RAMROD_CREATE_SUSPENDED_QP", "ROCE_RAMROD_RESUME_QP",
"ROCE_RAMROD_SUSPEND_UD_QP", "ROCE_RAMROD_RESUME_UD_QP",
"ROCE_RAMROD_CREATE_SUSPENDED_UD_QP", "ROCE_RAMROD_FLUSH_DPT_QP", },
{ "CORE_RAMROD_UNUSED", "CORE_RAMROD_RX_QUEUE_START",
"CORE_RAMROD_TX_QUEUE_START", "CORE_RAMROD_RX_QUEUE_STOP",
"CORE_RAMROD_TX_QUEUE_STOP",
"CORE_RAMROD_RX_QUEUE_FLUSH",
"CORE_RAMROD_TX_QUEUE_UPDATE", "CORE_RAMROD_QUEUE_STATS_QUERY", },
{ "ETH_RAMROD_UNUSED", "ETH_RAMROD_VPORT_START",
"ETH_RAMROD_VPORT_UPDATE", "ETH_RAMROD_VPORT_STOP",
"ETH_RAMROD_RX_QUEUE_START", "ETH_RAMROD_RX_QUEUE_STOP",
"ETH_RAMROD_TX_QUEUE_START", "ETH_RAMROD_TX_QUEUE_STOP",
"ETH_RAMROD_FILTERS_UPDATE", "ETH_RAMROD_RX_QUEUE_UPDATE",
"ETH_RAMROD_RX_CREATE_OPENFLOW_ACTION",
"ETH_RAMROD_RX_ADD_OPENFLOW_FILTER",
"ETH_RAMROD_RX_DELETE_OPENFLOW_FILTER",
"ETH_RAMROD_RX_ADD_UDP_FILTER",
"ETH_RAMROD_RX_DELETE_UDP_FILTER",
"ETH_RAMROD_RX_CREATE_GFT_ACTION",
"ETH_RAMROD_RX_UPDATE_GFT_FILTER", "ETH_RAMROD_TX_QUEUE_UPDATE",
"ETH_RAMROD_RGFS_FILTER_ADD", "ETH_RAMROD_RGFS_FILTER_DEL",
"ETH_RAMROD_TGFS_FILTER_ADD", "ETH_RAMROD_TGFS_FILTER_DEL",
"ETH_RAMROD_GFS_COUNTERS_REPORT_REQUEST", },
{ "RDMA_RAMROD_UNUSED", "RDMA_RAMROD_FUNC_INIT",
"RDMA_RAMROD_FUNC_CLOSE", "RDMA_RAMROD_REGISTER_MR",
"RDMA_RAMROD_DEREGISTER_MR", "RDMA_RAMROD_CREATE_CQ",
"RDMA_RAMROD_RESIZE_CQ", "RDMA_RAMROD_DESTROY_CQ",
"RDMA_RAMROD_CREATE_SRQ", "RDMA_RAMROD_MODIFY_SRQ",
"RDMA_RAMROD_DESTROY_SRQ", "RDMA_RAMROD_START_NS_TRACKING",
"RDMA_RAMROD_STOP_NS_TRACKING",
"IWARP_RAMROD_CMD_ID_TCP_OFFLOAD",
"IWARP_RAMROD_CMD_ID_MPA_OFFLOAD",
"IWARP_RAMROD_CMD_ID_MPA_OFFLOAD_SEND_RTR",
"IWARP_RAMROD_CMD_ID_CREATE_QP", "IWARP_RAMROD_CMD_ID_QUERY_QP",
"IWARP_RAMROD_CMD_ID_MODIFY_QP",
"IWARP_RAMROD_CMD_ID_DESTROY_QP",
"IWARP_RAMROD_CMD_ID_ABORT_TCP_OFFLOAD", },
{ NULL }, /*TOE*/
{ NULL }, /*PREROCE*/
{ "COMMON_RAMROD_UNUSED", "COMMON_RAMROD_PF_START",
"COMMON_RAMROD_PF_STOP", "COMMON_RAMROD_VF_START",
"COMMON_RAMROD_VF_STOP", "COMMON_RAMROD_PF_UPDATE",
"COMMON_RAMROD_RL_UPDATE", "COMMON_RAMROD_EMPTY", }
};
/******************** INTERNAL IMPLEMENTATION *********************/ /******************** INTERNAL IMPLEMENTATION *********************/
/* Returns the external VOQ number */ /* Returns the external VOQ number */
...@@ -1647,6 +1723,32 @@ void qed_enable_context_validation(struct qed_hwfn *p_hwfn, ...@@ -1647,6 +1723,32 @@ void qed_enable_context_validation(struct qed_hwfn *p_hwfn,
qed_wr(p_hwfn, p_ptt, CDU_REG_TCFC_CTX_VALID0, ctx_validation); qed_wr(p_hwfn, p_ptt, CDU_REG_TCFC_CTX_VALID0, ctx_validation);
} }
const char *qed_get_protocol_type_str(u32 protocol_type)
{
if (protocol_type >= ARRAY_SIZE(s_protocol_types))
return "Invalid protocol type";
return s_protocol_types[protocol_type];
}
const char *qed_get_ramrod_cmd_id_str(u32 protocol_type, u32 ramrod_cmd_id)
{
const char *ramrod_cmd_id_str;
if (protocol_type >= ARRAY_SIZE(s_ramrod_cmd_ids))
return "Invalid protocol type";
if (ramrod_cmd_id >= ARRAY_SIZE(s_ramrod_cmd_ids[0]))
return "Invalid Ramrod command ID";
ramrod_cmd_id_str = s_ramrod_cmd_ids[protocol_type][ramrod_cmd_id];
if (!ramrod_cmd_id_str)
return "Invalid Ramrod command ID";
return ramrod_cmd_id_str;
}
static u32 qed_get_rdma_assert_ram_addr(struct qed_hwfn *p_hwfn, u8 storm_id) static u32 qed_get_rdma_assert_ram_addr(struct qed_hwfn *p_hwfn, u8 storm_id)
{ {
switch (storm_id) { switch (storm_id) {
......
...@@ -85,10 +85,12 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, ...@@ -85,10 +85,12 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn,
goto err; goto err;
} }
DP_VERBOSE(p_hwfn, QED_MSG_SPQ, DP_VERBOSE(p_hwfn,
"Initialized: CID %08x cmd %02x protocol %02x data_addr %lu comp_mode [%s]\n", QED_MSG_SPQ,
opaque_cid, cmd, protocol, "Initialized: CID %08x %s:[%02x] %s:%02x data_addr %llx comp_mode [%s]\n",
(unsigned long)&p_ent->ramrod, opaque_cid, qed_get_ramrod_cmd_id_str(protocol, cmd),
cmd, qed_get_protocol_type_str(protocol), protocol,
(unsigned long long)(uintptr_t)&p_ent->ramrod,
D_TRINE(p_ent->comp_mode, QED_SPQ_MODE_EBLOCK, D_TRINE(p_ent->comp_mode, QED_SPQ_MODE_EBLOCK,
QED_SPQ_MODE_BLOCK, "MODE_EBLOCK", "MODE_BLOCK", QED_SPQ_MODE_BLOCK, "MODE_EBLOCK", "MODE_BLOCK",
"MODE_CB")); "MODE_CB"));
......
...@@ -139,9 +139,12 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, ...@@ -139,9 +139,12 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn,
if (!p_ptt) if (!p_ptt)
return -EBUSY; return -EBUSY;
qed_hw_err_notify(p_hwfn, p_ptt, QED_HW_ERR_RAMROD_FAIL, qed_hw_err_notify(p_hwfn, p_ptt, QED_HW_ERR_RAMROD_FAIL,
"Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n", "Ramrod is stuck [CID %08x %s:%02x %s:%02x echo %04x]\n",
le32_to_cpu(p_ent->elem.hdr.cid), le32_to_cpu(p_ent->elem.hdr.cid),
qed_get_ramrod_cmd_id_str(p_ent->elem.hdr.protocol_id,
p_ent->elem.hdr.cmd_id),
p_ent->elem.hdr.cmd_id, p_ent->elem.hdr.cmd_id,
qed_get_protocol_type_str(p_ent->elem.hdr.protocol_id),
p_ent->elem.hdr.protocol_id, p_ent->elem.hdr.protocol_id,
le16_to_cpu(p_ent->elem.hdr.echo)); le16_to_cpu(p_ent->elem.hdr.echo));
qed_ptt_release(p_hwfn, p_ptt); qed_ptt_release(p_hwfn, p_ptt);
...@@ -170,13 +173,16 @@ static int qed_spq_fill_entry(struct qed_hwfn *p_hwfn, ...@@ -170,13 +173,16 @@ static int qed_spq_fill_entry(struct qed_hwfn *p_hwfn,
return -EINVAL; return -EINVAL;
} }
DP_VERBOSE(p_hwfn, QED_MSG_SPQ, DP_VERBOSE(p_hwfn,
"Ramrod header: [CID 0x%08x CMD 0x%02x protocol 0x%02x] Data pointer: [%08x:%08x] Completion Mode: %s\n", QED_MSG_SPQ,
"Ramrod hdr: [CID 0x%08x %s:0x%02x %s:0x%02x] Data ptr: [%08x:%08x] Cmpltion Mode: %s\n",
p_ent->elem.hdr.cid, p_ent->elem.hdr.cid,
qed_get_ramrod_cmd_id_str(p_ent->elem.hdr.protocol_id,
p_ent->elem.hdr.cmd_id),
p_ent->elem.hdr.cmd_id, p_ent->elem.hdr.cmd_id,
qed_get_protocol_type_str(p_ent->elem.hdr.protocol_id),
p_ent->elem.hdr.protocol_id, p_ent->elem.hdr.protocol_id,
p_ent->elem.data_ptr.hi, p_ent->elem.data_ptr.hi, p_ent->elem.data_ptr.lo,
p_ent->elem.data_ptr.lo,
D_TRINE(p_ent->comp_mode, QED_SPQ_MODE_EBLOCK, D_TRINE(p_ent->comp_mode, QED_SPQ_MODE_EBLOCK,
QED_SPQ_MODE_BLOCK, "MODE_EBLOCK", "MODE_BLOCK", QED_SPQ_MODE_BLOCK, "MODE_EBLOCK", "MODE_BLOCK",
"MODE_CB")); "MODE_CB"));
...@@ -271,17 +277,27 @@ qed_async_event_completion(struct qed_hwfn *p_hwfn, ...@@ -271,17 +277,27 @@ qed_async_event_completion(struct qed_hwfn *p_hwfn,
{ {
qed_spq_async_comp_cb cb; qed_spq_async_comp_cb cb;
if (!p_hwfn->p_spq || (p_eqe->protocol_id >= MAX_PROTOCOL_TYPE)) if (!p_hwfn->p_spq)
return -EINVAL; return -EINVAL;
if (p_eqe->protocol_id >= MAX_PROTOCOL_TYPE) {
DP_ERR(p_hwfn, "Wrong protocol: %s:%d\n",
qed_get_protocol_type_str(p_eqe->protocol_id),
p_eqe->protocol_id);
return -EINVAL;
}
cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id]; cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id];
if (cb) { if (cb) {
return cb(p_hwfn, p_eqe->opcode, p_eqe->echo, return cb(p_hwfn, p_eqe->opcode, p_eqe->echo,
&p_eqe->data, p_eqe->fw_return_code); &p_eqe->data, p_eqe->fw_return_code);
} else { } else {
DP_NOTICE(p_hwfn, DP_NOTICE(p_hwfn,
"Unknown Async completion for protocol: %d\n", "Unknown Async completion for %s:%d\n",
qed_get_protocol_type_str(p_eqe->protocol_id),
p_eqe->protocol_id); p_eqe->protocol_id);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -830,8 +846,12 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, ...@@ -830,8 +846,12 @@ int qed_spq_post(struct qed_hwfn *p_hwfn,
if (p_hwfn->cdev->recov_in_prog) { if (p_hwfn->cdev->recov_in_prog) {
DP_VERBOSE(p_hwfn, DP_VERBOSE(p_hwfn,
QED_MSG_SPQ, QED_MSG_SPQ,
"Recovery is in progress. Skip spq post [cmd %02x protocol %02x]\n", "Recovery is in progress. Skip spq post [%s:%02x %s:%02x]\n",
p_ent->elem.hdr.cmd_id, p_ent->elem.hdr.protocol_id); qed_get_ramrod_cmd_id_str(p_ent->elem.hdr.protocol_id,
p_ent->elem.hdr.cmd_id),
p_ent->elem.hdr.cmd_id,
qed_get_protocol_type_str(p_ent->elem.hdr.protocol_id),
p_ent->elem.hdr.protocol_id);
/* Let the flow complete w/o any error handling */ /* Let the flow complete w/o any error handling */
qed_spq_recov_set_ret_code(p_ent, fw_return_code); qed_spq_recov_set_ret_code(p_ent, fw_return_code);
......
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