Unverified Commit 18ebc6fc authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3008 [OLK-5.10] ub: Fix bugs in urma kernel and user lib

Merge Pull Request from: @yizhen-fan 
 
driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8J45G


CVE: NA

--------------------------------

Fix bugs in urma kernel and user lib
- Rollback process vtp entry status fix
- Fix vf and pf eid filling bug
- Fix the rebuild chain problem in rc mode
- Add support for query link rebuild finish
- opt create vtp contex, avoid frequent hmap find operation
- Fix that problem that cannot find pf_dev on vm open
- Fix the problem that upi format is not stable OPEN
- DFX bugfix, mod utp_id from u8 to u32, RC mode use tpgn in show res
- Fixed the problem of link building failure and TP resource leakage
- Fix the problem that the query result of urma_admin show is wrong
- fix slice cfg will not cfg to driver
- optimize create vtp context, avoid duplicate code
- Fixed the bug where no exception occurred when illegal commands entered
by urma admin
- Fix urma_sub and urma_kmod_sub codecheck
- Fix two problems: 1. dip table wrong print 2.use after free OPEN
- Fix the bug of modify tp attr
- fix tpsa_tp_flag not consistent with ubcore_tp_cfg_flag
- Bond event monitoring OPEN
- Namespace: assign eid for ns
- Encapsulation of hashmap find, destroy and insert operation
- Fix the problem that sip_table add doesn't check the number of param OPEN
- Adapt to alpha version chain negotiation

Signed-off-by: default avatarGuoxin Qian <qianguoxin@huawei.com>
Signed-off-by: default avatarYizhen Fan <fanyizhen@huawei.com>
Signed-off-by: default avatarChunzhi Hu <huchunzhi@huawei.com>

[LLT result]
- urma llt result:
![urma-llt](https://foruda.gitee.com/images/1701070289071131310/0dd840c8_13406429.png "1123-urma-llt.png")

- udma llt result
![udma-llt](https://foruda.gitee.com/images/1701070325639757485/760de082_13406429.png "1123-udma-llt.png")
![udma-llt2](https://foruda.gitee.com/images/1701073391098572246/8a445b3f_13406429.png "1123-udma-llt2.png")
 
 
Link:https://gitee.com/openeuler/kernel/pulls/3008

 

Reviewed-by: default avatarChunzhi Hu <huchunzhi@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 6374096d 37c6170f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@
#include "hns3_udma_hw.h"
#include "hns3_udma_common.h"

#define UB_DEV_BASE_NAME "ubl"
#define UB_DEV_NAME_SHIFT 3

#define UDMA_MAX_PORTS				6

#define BA_BYTE_LEN				8
@@ -56,7 +59,6 @@
#define udma_hw_page_align(x)		ALIGN(x, 1 << UDMA_HW_PAGE_SHIFT)

#define UDMA_DWQE_SIZE				65536
#define UDMA_DWQE_MMAP_QP_NUM			1024

#define UDMA_HOP_NUM_0				0xff
#define UDMA_CAP_FLAGS_EX_SHIFT			12
@@ -831,6 +833,8 @@ struct udma_dev {
	void				*priv;
	struct workqueue_struct		*irq_workq;
	struct work_struct		ecc_work;
	uint8_t				chip_id;
	uint8_t				die_id;
	uint16_t			func_id;
	uint32_t			func_num;
	uint32_t			cong_algo_tmpl_id;
+0 −5
Original line number Diff line number Diff line
@@ -115,11 +115,6 @@ static int del_eid_entry(struct udma_dev *udma_dev, uint32_t eid_index)
	return clear_gmv_table(udma_dev, eid_index);
}

int udma_set_eid(struct ubcore_device *dev, union ubcore_eid eid)
{
	return 0;
}

static int udma_check_ueid_cfg(struct udma_dev *dev, uint16_t fe_idx,
			       uint32_t eid_index)
{
+0 −1
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ struct udma_eid {
	enum udma_sgid_type type;
};

int udma_set_eid(struct ubcore_device *dev, union ubcore_eid eid);
int udma_add_ueid(struct ubcore_device *dev, uint16_t fe_idx, struct ubcore_ueid_cfg *cfg);
int udma_delete_ueid(struct ubcore_device *dev, uint16_t fe_idx,
		     struct ubcore_ueid_cfg *cfg);
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ static int udma_query_func_id(struct udma_dev *udma_dev)
	}

	resp = (struct udma_hw_id_query_cmq *)desc.data;
	udma_dev->chip_id = resp->chip_id;
	udma_dev->die_id = resp->die_id;
	udma_dev->func_id = (uint16_t)le32_to_cpu(resp->func_id);
	return 0;

+45 −8
Original line number Diff line number Diff line
@@ -427,19 +427,51 @@ static int udma_query_device_status(struct ubcore_device *dev,
	return 0;
}

int udma_send_msg(struct ubcore_device *dev, struct ubcore_msg *msg)
int udma_send_req(struct ubcore_device *dev, struct ubcore_req *msg)
{
	struct udma_dev *udma_dev = to_udma_dev(dev);
	struct ubcore_req_host *req_host_msg;
	int ret;

	if (msg == NULL) {
		dev_err(udma_dev->dev, "The message to be sent is empty.\n");
		dev_err(udma_dev->dev, "The req message to be sent is empty.\n");
		return -EINVAL;
	}

	ret = ubcore_recv_msg(dev, msg);
	req_host_msg = kzalloc(sizeof(struct ubcore_req_host) + msg->len, GFP_KERNEL);
	if (!req_host_msg)
		return -ENOMEM;

	req_host_msg->src_fe_idx = 0;
	memcpy(&req_host_msg->req, msg, sizeof(struct ubcore_req_host) + msg->len);
	ret = ubcore_recv_req(dev, req_host_msg);
	if (ret)
		dev_err(udma_dev->dev, "Fail to recv msg, ret = %d.\n", ret);
		dev_err(udma_dev->dev, "Fail to recv req msg, ret = %d.\n", ret);
	kfree(req_host_msg);

	return ret;
}

int udma_send_resp(struct ubcore_device *dev, struct ubcore_resp_host *msg)
{
	struct udma_dev *udma_dev = to_udma_dev(dev);
	struct ubcore_resp *resp_msg;
	int ret;

	if (msg == NULL) {
		dev_err(udma_dev->dev, "The resp message to be sent is empty.\n");
		return -EINVAL;
	}

	resp_msg = kzalloc(sizeof(struct ubcore_resp) + msg->resp.len, GFP_KERNEL);
	if (!resp_msg)
		return -ENOMEM;

	memcpy(resp_msg, &msg->resp, sizeof(struct ubcore_resp) + msg->resp.len);
	ret = ubcore_recv_resp(dev, resp_msg);
	if (ret)
		dev_err(udma_dev->dev, "Fail to recv resp msg, ret = %d.\n", ret);
	kfree(resp_msg);

	return ret;
}
@@ -903,7 +935,6 @@ int udma_user_ctl(struct ubcore_user_ctl *k_user_ctl)
static struct ubcore_ops g_udma_dev_ops = {
	.owner = THIS_MODULE,
	.abi_version = 1,
	.set_eid = udma_set_eid,
	.add_ueid = udma_add_ueid,
	.delete_ueid = udma_delete_ueid,
	.query_device_attr = udma_query_device_attr,
@@ -933,7 +964,8 @@ static struct ubcore_ops g_udma_dev_ops = {
	.create_tp = udma_create_tp,
	.modify_tp = udma_modify_tp,
	.destroy_tp = udma_destroy_tp,
	.send_msg = udma_send_msg,
	.send_req = udma_send_req,
	.send_resp = udma_send_resp,
	.user_ctl = udma_user_ctl,
	.query_stats = udma_query_stats,
};
@@ -1391,8 +1423,13 @@ void udma_set_poe_ch_num(struct udma_dev *dev)
static void udma_set_devname(struct udma_dev *udma_dev,
			     struct ubcore_device *ub_dev)
{
	scnprintf(udma_dev->dev_name, UBCORE_MAX_DEV_NAME, "udma%d",
		  udma_dev->func_id);
	if (strncasecmp(ub_dev->netdev->name, UB_DEV_BASE_NAME, UB_DEV_NAME_SHIFT))
		scnprintf(udma_dev->dev_name, UBCORE_MAX_DEV_NAME, "udma_c%ud%uf%u",
			  udma_dev->chip_id, udma_dev->die_id, udma_dev->func_id);
	else
		scnprintf(udma_dev->dev_name, UBCORE_MAX_DEV_NAME, "udma%s",
			  ub_dev->netdev->name + UB_DEV_NAME_SHIFT);

	dev_info(udma_dev->dev, "Set dev_name %s\n", udma_dev->dev_name);
	strlcpy(ub_dev->dev_name, udma_dev->dev_name, UBCORE_MAX_DEV_NAME);
}
Loading