提交 ca83a572 编写于 作者: L lipeng 提交者: Xie XiuQi

add all IMP return code

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

Driver just distinguishs part of IMP return code, This patch adds
all IMP return code.

Feature or Bugfix: Bugfix
Signed-off-by: Nlipeng (Y) <lipeng321@huawei.com>
Reviewed-by: Nshenjian <shenjian15@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 46f655fe
...@@ -187,12 +187,43 @@ static bool hclge_is_special_opcode(u16 opcode) ...@@ -187,12 +187,43 @@ static bool hclge_is_special_opcode(u16 opcode)
return false; return false;
} }
static int hclge_cmd_convert_err_code(u16 desc_ret)
{
switch (desc_ret) {
case HCLGE_CMD_EXEC_SUCCESS:
return 0;
case HCLGE_CMD_NO_AUTH:
return -EPERM;
case HCLGE_CMD_NOT_SUPPORTED:
return -EOPNOTSUPP;
case HCLGE_CMD_QUEUE_FULL:
return -EXFULL;
case HCLGE_CMD_NEXT_ERR:
return -ENOSR;
case HCLGE_CMD_UNEXE_ERR:
return -ENOTBLK;
case HCLGE_CMD_PARA_ERR:
return -EINVAL;
case HCLGE_CMD_RESULT_ERR:
return -ERANGE;
case HCLGE_CMD_TIMEOUT:
return -ETIME;
case HCLGE_CMD_HILINK_ERR:
return -ENOLINK;
case HCLGE_CMD_QUEUE_ILLEGAL:
return -ENXIO;
case HCLGE_CMD_INVALID:
return -EBADR;
default:
return -EIO;
}
}
static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc, static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc,
int num, int ntc) int num, int ntc)
{ {
u16 opcode, desc_ret; u16 opcode, desc_ret;
int handle; int handle;
int retval;
opcode = le16_to_cpu(desc[0].opcode); opcode = le16_to_cpu(desc[0].opcode);
for (handle = 0; handle < num; handle++) { for (handle = 0; handle < num; handle++) {
...@@ -206,19 +237,9 @@ static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc, ...@@ -206,19 +237,9 @@ static int hclge_cmd_check_retval(struct hclge_hw *hw, struct hclge_desc *desc,
else else
desc_ret = le16_to_cpu(desc[0].retval); desc_ret = le16_to_cpu(desc[0].retval);
if (desc_ret == HCLGE_CMD_EXEC_SUCCESS)
retval = 0;
else if (desc_ret == HCLGE_CMD_NO_AUTH)
retval = -EPERM;
else if (desc_ret == HCLGE_CMD_NOT_SUPPORTED)
retval = -EOPNOTSUPP;
else if (desc_ret == HCLGE_CMD_QUEUE_ILLEGAL)
retval = -ENXIO;
else
retval = -EIO;
hw->cmq.last_status = desc_ret; hw->cmq.last_status = desc_ret;
return retval; return hclge_cmd_convert_err_code(desc_ret);
} }
/** /**
......
...@@ -41,7 +41,14 @@ enum hclge_cmd_return_status { ...@@ -41,7 +41,14 @@ enum hclge_cmd_return_status {
HCLGE_CMD_NO_AUTH = 1, HCLGE_CMD_NO_AUTH = 1,
HCLGE_CMD_NOT_SUPPORTED = 2, HCLGE_CMD_NOT_SUPPORTED = 2,
HCLGE_CMD_QUEUE_FULL = 3, HCLGE_CMD_QUEUE_FULL = 3,
HCLGE_CMD_NEXT_ERR = 4,
HCLGE_CMD_UNEXE_ERR = 5,
HCLGE_CMD_PARA_ERR = 6,
HCLGE_CMD_RESULT_ERR = 7,
HCLGE_CMD_TIMEOUT = 8,
HCLGE_CMD_HILINK_ERR = 9,
HCLGE_CMD_QUEUE_ILLEGAL = 10, HCLGE_CMD_QUEUE_ILLEGAL = 10,
HCLGE_CMD_INVALID = 11,
}; };
enum hclge_cmd_status { enum hclge_cmd_status {
......
...@@ -181,6 +181,38 @@ void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc, ...@@ -181,6 +181,38 @@ void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc,
desc->flag &= cpu_to_le16(~HCLGEVF_CMD_FLAG_WR); desc->flag &= cpu_to_le16(~HCLGEVF_CMD_FLAG_WR);
} }
static int hclgevf_cmd_convert_err_code(u16 desc_ret)
{
switch (desc_ret) {
case HCLGEVF_CMD_EXEC_SUCCESS:
return 0;
case HCLGEVF_CMD_NO_AUTH:
return -EPERM;
case HCLGEVF_CMD_NOT_SUPPORTED:
return -EOPNOTSUPP;
case HCLGEVF_CMD_QUEUE_FULL:
return -EXFULL;
case HCLGEVF_CMD_NEXT_ERR:
return -ENOSR;
case HCLGEVF_CMD_UNEXE_ERR:
return -ENOTBLK;
case HCLGEVF_CMD_PARA_ERR:
return -EINVAL;
case HCLGEVF_CMD_RESULT_ERR:
return -ERANGE;
case HCLGEVF_CMD_TIMEOUT:
return -ETIME;
case HCLGEVF_CMD_HILINK_ERR:
return -ENOLINK;
case HCLGEVF_CMD_QUEUE_ILLEGAL:
return -ENXIO;
case HCLGEVF_CMD_INVALID:
return -EBADR;
default:
return -EIO;
}
}
/* hclgevf_cmd_send - send command to command queue /* hclgevf_cmd_send - send command to command queue
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
* @desc: prefilled descriptor for describing the command * @desc: prefilled descriptor for describing the command
...@@ -253,11 +285,7 @@ int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclgevf_desc *desc, int num) ...@@ -253,11 +285,7 @@ int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclgevf_desc *desc, int num)
else else
retval = le16_to_cpu(desc[0].retval); retval = le16_to_cpu(desc[0].retval);
if ((enum hclgevf_cmd_return_status)retval == status = hclgevf_cmd_convert_err_code(retval);
HCLGEVF_CMD_EXEC_SUCCESS)
status = 0;
else
status = -EIO;
hw->cmq.last_status = (enum hclgevf_cmd_status)retval; hw->cmq.last_status = (enum hclgevf_cmd_status)retval;
ntc++; ntc++;
handle++; handle++;
......
...@@ -46,9 +46,17 @@ struct hclgevf_cmq_ring { ...@@ -46,9 +46,17 @@ struct hclgevf_cmq_ring {
enum hclgevf_cmd_return_status { enum hclgevf_cmd_return_status {
HCLGEVF_CMD_EXEC_SUCCESS = 0, HCLGEVF_CMD_EXEC_SUCCESS = 0,
HCLGEVF_CMD_NO_AUTH = 1, HCLGEVF_CMD_NO_AUTH = 1,
HCLGEVF_CMD_NOT_EXEC = 2, HCLGEVF_CMD_NOT_SUPPORTED = 2,
HCLGEVF_CMD_QUEUE_FULL = 3, HCLGEVF_CMD_QUEUE_FULL = 3,
HCLGEVF_CMD_NEXT_ERR = 4,
HCLGEVF_CMD_UNEXE_ERR = 5,
HCLGEVF_CMD_PARA_ERR = 6,
HCLGEVF_CMD_RESULT_ERR = 7,
HCLGEVF_CMD_TIMEOUT = 8,
HCLGEVF_CMD_HILINK_ERR = 9,
HCLGEVF_CMD_QUEUE_ILLEGAL = 10,
HCLGEVF_CMD_INVALID = 11,
}; };
enum hclgevf_cmd_status { enum hclgevf_cmd_status {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册