Commit 481ef9ce authored by Yanling Song's avatar Yanling Song Committed by Zheng Zengkai
Browse files

SCSI: spfc: Update lb mode acquired solution

Ramaxel inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4QLBP


CVE: NA

Changes:
1. Read lb mode from chip
2. Disable fake vf function
3. Remove unnecessary code

Signed-off-by: default avatarYanling Song <songyl@ramaxel.com>
Reviewed-by: default avatarYun Xu <xuyun@ramaxel.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 8b2c7888
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ struct cfg_cmd_dev_cap {

	u8 sf_svc_attr;
	u8 func_sf_en;
	u16 rsvd_sf;
	u8 lb_mode;
	u8 smf_pg;

	u32 max_conn_num;
	u16 max_stick2cache_num;
+3 −0
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ static void parse_pub_res_cap(struct sphw_hwdev *hwdev,
	else
		cap->sf_en = false;

	cap->lb_mode = dev_cap->lb_mode;
	cap->smf_pg = dev_cap->smf_pg;

	cap->timer_en = (u8)timer_enable; /* timer enable */
	cap->host_oq_id_mask_val = dev_cap->host_oq_id_mask_val;
	cap->max_connect_num = dev_cap->max_conn_num;
+3 −0
Original line number Diff line number Diff line
@@ -201,6 +201,9 @@ struct service_cap {
	u8 timer_en;    /* 0:disable, 1:enable */
	u8 bloomfilter_en; /* 0:disable, 1:enable*/

	u8 lb_mode;
	u8 smf_pg;

	/* For test */
	u32 test_mode;
	u32 test_qpc_num;
+4 −39
Original line number Diff line number Diff line
@@ -53,17 +53,6 @@ cqm_bat_fill_cla_common_gpa(struct cqm_handle *cqm_handle,
		gpa.acs_spu_en = 0;
	}

	/* In fake mode, fake_vf_en in the GPA address of the BAT
	 * must be set to 1.
	 */
	if (cqm_handle->func_capability.fake_func_type == CQM_FAKE_FUNC_CHILD) {
		gpa.fake_vf_en = 1;
		func_attr = &cqm_handle->parent_cqm_handle->func_attribute;
		gpa.pf_id = func_attr->func_global_idx;
	} else {
		gpa.fake_vf_en = 0;
	}

	memcpy(&cla_gpa_h, &gpa, sizeof(u32));
	bat_entry_standerd->cla_gpa_h = cla_gpa_h;

@@ -379,12 +368,7 @@ s32 cqm_bat_update(struct cqm_handle *cqm_handle)
	CQM_PTR_CHECK_RET(buf_in, CQM_FAIL, CQM_ALLOC_FAIL(buf_in));
	buf_in->size = sizeof(struct cqm_cmdq_bat_update);

	/* In non-fake mode, func_id is set to 0xffff, indicating the current func.
	 * In fake mode, the value of func_id is specified. This is a fake func_id.
	 */
	if (cqm_handle->func_capability.fake_func_type == CQM_FAKE_FUNC_CHILD)
		func_id = cqm_handle->func_attribute.func_global_idx;
	else
	/* In non-fake mode, func_id is set to 0xffff */
	func_id = 0xffff;

	/* The LB scenario is supported.
@@ -545,19 +529,6 @@ s32 cqm_cla_fill_buf(struct cqm_handle *cqm_handle, struct cqm_buf *cla_base_buf
			spu_en = 0;
		}

		/* fake enable */
		if (cqm_handle->func_capability.fake_func_type ==
		    CQM_FAKE_FUNC_CHILD) {
			fake_en = 1ULL << 62;
			func_attr =
			    &cqm_handle->parent_cqm_handle->func_attribute;
			pf_id = func_attr->func_global_idx;
			pf_id = (pf_id & 0x1f) << 57;
		} else {
			fake_en = 0;
			pf_id = 0;
		}

		*base = (((((cla_sub_buf->buf_list[i].pa & CQM_CHIP_GPA_MASK) |
			    spu_en) |
			   fake_en) |
@@ -1248,13 +1219,7 @@ s32 cqm_cla_update(struct cqm_handle *cqm_handle, struct cqm_buf_list *buf_node_
		}
	}

	/* In non-fake mode, set func_id to 0xffff.
	 * Indicates the current func fake mode, set func_id to the
	 * specified value, This is a fake func_id.
	 */
	if (cqm_handle->func_capability.fake_func_type == CQM_FAKE_FUNC_CHILD)
		cmd.func_id = cqm_handle->func_attribute.func_global_idx;
	else
	/* In non-fake mode, set func_id to 0xffff. */
	cmd.func_id = 0xffff;

	/* Mode 0 is hashed to 4 SMF engines (excluding PPF) by func ID. */
+2 −8
Original line number Diff line number Diff line
@@ -405,13 +405,7 @@ s32 cqm_cla_cache_invalid(struct cqm_handle *cqm_handle, dma_addr_t gpa, u32 cac
	cmd.gpa_h = CQM_ADDR_HI(gpa);
	cmd.gpa_l = CQM_ADDR_LW(gpa);

	/* In non-fake mode, set func_id to 0xffff.
	 * Indicate the current func fake mode.
	 * The value of func_id is a fake func ID.
	 */
	if (cqm_handle->func_capability.fake_func_type == CQM_FAKE_FUNC_CHILD)
		cmd.func_id = cqm_handle->func_attribute.func_global_idx;
	else
	/* In non-fake mode, set func_id to 0xffff. */
	cmd.func_id = 0xffff;

	/* Mode 0 is hashed to 4 SMF engines (excluding PPF) by func ID. */
Loading