Commit ce83278f authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'qed-enhancements'

Manish Chopra says:

====================
qed*: enhancements

This series adds below enhancements for qed/qede drivers

patch 1: Improves tx timeout debug data logs.
patch 2: Add ESL(Enhanced system lockdown) priv flag cap/status support.

v2:
* Fixed cosmetic issues in both patches
* Added ESL feature description in patch #2

Please consider applying it to "net-next"
====================

Link: https://lore.kernel.org/r/20211202210157.25530-1-manishc@marvell.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents bb14bfc7 823163ba
Loading
Loading
Loading
Loading
+22 −0
Original line number Original line Diff line number Diff line
@@ -2399,3 +2399,25 @@ int qed_int_set_timer_res(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,


	return rc;
	return rc;
}
}

int qed_int_get_sb_dbg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
		       struct qed_sb_info *p_sb, struct qed_sb_info_dbg *p_info)
{
	u16 sbid = p_sb->igu_sb_id;
	u32 i;

	if (IS_VF(p_hwfn->cdev))
		return -EINVAL;

	if (sbid >= NUM_OF_SBS(p_hwfn->cdev))
		return -EINVAL;

	p_info->igu_prod = qed_rd(p_hwfn, p_ptt, IGU_REG_PRODUCER_MEMORY + sbid * 4);
	p_info->igu_cons = qed_rd(p_hwfn, p_ptt, IGU_REG_CONSUMER_MEM + sbid * 4);

	for (i = 0; i < PIS_PER_SB; i++)
		p_info->pi[i] = (u16)qed_rd(p_hwfn, p_ptt,
					    CAU_REG_PI_MEMORY + sbid * 4 * PIS_PER_SB + i * 4);

	return 0;
}
+13 −0
Original line number Original line Diff line number Diff line
@@ -185,6 +185,19 @@ void qed_int_disable_post_isr_release(struct qed_dev *cdev);
 */
 */
void qed_int_attn_clr_enable(struct qed_dev *cdev, bool clr_enable);
void qed_int_attn_clr_enable(struct qed_dev *cdev, bool clr_enable);


/**
 * qed_int_get_sb_dbg: Read debug information regarding a given SB
 *
 * @p_hwfn: hw function pointer
 * @p_ptt: ptt resource
 * @p_sb: pointer to status block for which we want to get info
 * @p_info: pointer to struct to fill with information regarding SB
 *
 * Return: 0 with status block info filled on success, otherwise return error
 */
int qed_int_get_sb_dbg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
		       struct qed_sb_info *p_sb, struct qed_sb_info_dbg *p_info);

/**
/**
 * qed_db_rec_handler(): Doorbell Recovery handler.
 * qed_db_rec_handler(): Doorbell Recovery handler.
 *          Run doorbell recovery in case of PF overflow (and flush DORQ if
 *          Run doorbell recovery in case of PF overflow (and flush DORQ if
+71 −1
Original line number Original line Diff line number Diff line
@@ -447,7 +447,7 @@ int qed_fill_dev_info(struct qed_dev *cdev,
			dev_info->wol_support = true;
			dev_info->wol_support = true;


		dev_info->smart_an = qed_mcp_is_smart_an_supported(p_hwfn);
		dev_info->smart_an = qed_mcp_is_smart_an_supported(p_hwfn);

		dev_info->esl = qed_mcp_is_esl_supported(p_hwfn);
		dev_info->abs_pf_id = QED_LEADING_HWFN(cdev)->abs_pf_id;
		dev_info->abs_pf_id = QED_LEADING_HWFN(cdev)->abs_pf_id;
	} else {
	} else {
		qed_vf_get_fw_version(&cdev->hwfns[0], &dev_info->fw_major,
		qed_vf_get_fw_version(&cdev->hwfns[0], &dev_info->fw_major,
@@ -2936,6 +2936,30 @@ static int qed_update_mtu(struct qed_dev *cdev, u16 mtu)
	return status;
	return status;
}
}


static int
qed_get_sb_info(struct qed_dev *cdev, struct qed_sb_info *sb,
		u16 qid, struct qed_sb_info_dbg *sb_dbg)
{
	struct qed_hwfn *hwfn = &cdev->hwfns[qid % cdev->num_hwfns];
	struct qed_ptt *ptt;
	int rc;

	if (IS_VF(cdev))
		return -EINVAL;

	ptt = qed_ptt_acquire(hwfn);
	if (!ptt) {
		DP_NOTICE(hwfn, "Can't acquire PTT\n");
		return -EAGAIN;
	}

	memset(sb_dbg, 0, sizeof(*sb_dbg));
	rc = qed_int_get_sb_dbg(hwfn, ptt, sb, sb_dbg);

	qed_ptt_release(hwfn, ptt);
	return rc;
}

static int qed_read_module_eeprom(struct qed_dev *cdev, char *buf,
static int qed_read_module_eeprom(struct qed_dev *cdev, char *buf,
				  u8 dev_addr, u32 offset, u32 len)
				  u8 dev_addr, u32 offset, u32 len)
{
{
@@ -2978,11 +3002,54 @@ static int qed_set_grc_config(struct qed_dev *cdev, u32 cfg_id, u32 val)
	return rc;
	return rc;
}
}


static __printf(2, 3) void qed_mfw_report(struct qed_dev *cdev, char *fmt, ...)
{
	char buf[QED_MFW_REPORT_STR_SIZE];
	struct qed_hwfn *p_hwfn;
	struct qed_ptt *p_ptt;
	va_list vl;

	va_start(vl, fmt);
	vsnprintf(buf, QED_MFW_REPORT_STR_SIZE, fmt, vl);
	va_end(vl);

	if (IS_PF(cdev)) {
		p_hwfn = QED_LEADING_HWFN(cdev);
		p_ptt = qed_ptt_acquire(p_hwfn);
		if (p_ptt) {
			qed_mcp_send_raw_debug_data(p_hwfn, p_ptt, buf, strlen(buf));
			qed_ptt_release(p_hwfn, p_ptt);
		}
	}
}

static u8 qed_get_affin_hwfn_idx(struct qed_dev *cdev)
static u8 qed_get_affin_hwfn_idx(struct qed_dev *cdev)
{
{
	return QED_AFFIN_HWFN_IDX(cdev);
	return QED_AFFIN_HWFN_IDX(cdev);
}
}


static int qed_get_esl_status(struct qed_dev *cdev, bool *esl_active)
{
	struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
	struct qed_ptt *ptt;
	int rc = 0;

	*esl_active = false;

	if (IS_VF(cdev))
		return 0;

	ptt = qed_ptt_acquire(hwfn);
	if (!ptt)
		return -EAGAIN;

	rc = qed_mcp_get_esl_status(hwfn, ptt, esl_active);

	qed_ptt_release(hwfn, ptt);

	return rc;
}

static struct qed_selftest_ops qed_selftest_ops_pass = {
static struct qed_selftest_ops qed_selftest_ops_pass = {
	.selftest_memory = &qed_selftest_memory,
	.selftest_memory = &qed_selftest_memory,
	.selftest_interrupt = &qed_selftest_interrupt,
	.selftest_interrupt = &qed_selftest_interrupt,
@@ -3038,6 +3105,9 @@ const struct qed_common_ops qed_common_ops_pass = {
	.read_nvm_cfg = &qed_nvm_flash_cfg_read,
	.read_nvm_cfg = &qed_nvm_flash_cfg_read,
	.read_nvm_cfg_len = &qed_nvm_flash_cfg_len,
	.read_nvm_cfg_len = &qed_nvm_flash_cfg_len,
	.set_grc_config = &qed_set_grc_config,
	.set_grc_config = &qed_set_grc_config,
	.mfw_report = &qed_mfw_report,
	.get_sb_info = &qed_get_sb_info,
	.get_esl_status = &qed_get_esl_status,
};
};


void qed_get_protocol_stats(struct qed_dev *cdev,
void qed_get_protocol_stats(struct qed_dev *cdev,
+22 −0
Original line number Original line Diff line number Diff line
@@ -4158,3 +4158,25 @@ qed_mcp_send_raw_debug_data(struct qed_hwfn *p_hwfn,
	return qed_mcp_send_debug_data(p_hwfn, p_ptt,
	return qed_mcp_send_debug_data(p_hwfn, p_ptt,
				       QED_MCP_DBG_DATA_TYPE_RAW, p_buf, size);
				       QED_MCP_DBG_DATA_TYPE_RAW, p_buf, size);
}
}

bool qed_mcp_is_esl_supported(struct qed_hwfn *p_hwfn)
{
	return !!(p_hwfn->mcp_info->capabilities &
		  FW_MB_PARAM_FEATURE_SUPPORT_ENHANCED_SYS_LCK);
}

int qed_mcp_get_esl_status(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, bool *active)
{
	u32 resp = 0, param = 0;
	int rc;

	rc = qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_GET_MANAGEMENT_STATUS, 0, &resp, &param);
	if (rc) {
		DP_NOTICE(p_hwfn, "Failed to send ESL command, rc = %d\n", rc);
		return rc;
	}

	*active = !!(param & FW_MB_PARAM_MANAGEMENT_STATUS_LOCKDOWN_ENABLED);

	return 0;
}
+22 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
#include "qed_hsi.h"
#include "qed_hsi.h"
#include "qed_dev_api.h"
#include "qed_dev_api.h"


#define QED_MFW_REPORT_STR_SIZE	256

struct qed_mcp_link_speed_params {
struct qed_mcp_link_speed_params {
	bool					autoneg;
	bool					autoneg;


@@ -1337,4 +1339,24 @@ int qed_mcp_nvm_get_cfg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
int qed_mcp_nvm_set_cfg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
int qed_mcp_nvm_set_cfg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
			u16 option_id, u8 entity_id, u16 flags, u8 *p_buf,
			u16 option_id, u8 entity_id, u16 flags, u8 *p_buf,
			u32 len);
			u32 len);

/**
 * qed_mcp_is_esl_supported(): Return whether management firmware support ESL or not.
 *
 * @p_hwfn: hw function pointer
 *
 * Return: true if esl is supported, otherwise return false
 */
bool qed_mcp_is_esl_supported(struct qed_hwfn *p_hwfn);

/**
 * qed_mcp_get_esl_status(): Get enhanced system lockdown status
 *
 * @p_hwfn: hw function pointer
 * @p_ptt: ptt resource pointer
 * @active: ESL active status data pointer
 *
 * Return: 0 with esl status info on success, otherwise return error
 */
int qed_mcp_get_esl_status(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, bool *active);
#endif
#endif
Loading