Skip to content

Commit

Permalink
net/hns3: fix use of command status enumeration
Browse files Browse the repository at this point in the history
[ upstream commit a32eaf4 ]

The type of return value of hns3_cmd_send is int, some function declare
the return value as hns3_cmd_status.

This patch fix the incorrect use of the enum hns3_cmd_status.

Fixes: 737f30e ("net/hns3: support command interface with firmware")
Fixes: 02a7b55 ("net/hns3: support Rx interrupt")

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
Chengchang Tang authored and steevenlee committed May 8, 2021
1 parent a0cffe3 commit f20ccda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion drivers/net/hns3/hns3_cmd.c
Expand Up @@ -450,7 +450,7 @@ hns3_build_api_caps(void)
return rte_cpu_to_le_32(api_caps);
}

static enum hns3_cmd_status
static int
hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw)
{
struct hns3_query_version_cmd *resp;
Expand Down
9 changes: 1 addition & 8 deletions drivers/net/hns3/hns3_cmd.h
Expand Up @@ -55,13 +55,6 @@ enum hns3_cmd_return_status {
HNS3_CMD_INVALID = 11,
};

enum hns3_cmd_status {
HNS3_STATUS_SUCCESS = 0,
HNS3_ERR_CSQ_FULL = -1,
HNS3_ERR_CSQ_TIMEOUT = -2,
HNS3_ERR_CSQ_ERROR = -3,
};

struct hns3_misc_vector {
uint8_t *addr;
int vector_irq;
Expand All @@ -71,7 +64,7 @@ struct hns3_cmq {
struct hns3_cmq_ring csq;
struct hns3_cmq_ring crq;
uint16_t tx_timeout;
enum hns3_cmd_status last_status;
enum hns3_cmd_return_status last_status;
};

enum hns3_opcode_type {
Expand Down
12 changes: 6 additions & 6 deletions drivers/net/hns3/hns3_ethdev.c
Expand Up @@ -2223,11 +2223,11 @@ hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en,
struct hns3_cmd_desc desc;
struct hns3_ctrl_vector_chain_cmd *req =
(struct hns3_ctrl_vector_chain_cmd *)desc.data;
enum hns3_cmd_status status;
enum hns3_opcode_type op;
uint16_t tqp_type_and_id = 0;
uint16_t type;
uint16_t gl;
int ret;

op = en ? HNS3_OPC_ADD_RING_TO_VECTOR : HNS3_OPC_DEL_RING_TO_VECTOR;
hns3_cmd_setup_basic_desc(&desc, op, false);
Expand All @@ -2250,11 +2250,11 @@ hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en,
gl);
req->tqp_type_and_id[0] = rte_cpu_to_le_16(tqp_type_and_id);
req->int_cause_num = 1;
status = hns3_cmd_send(hw, &desc, 1);
if (status) {
hns3_err(hw, "%s TQP %u fail, vector_id is %u, status is %d.",
en ? "Map" : "Unmap", queue_id, vector_id, status);
return status;
ret = hns3_cmd_send(hw, &desc, 1);
if (ret) {
hns3_err(hw, "%s TQP %u fail, vector_id = %u, ret = %d.",
en ? "Map" : "Unmap", queue_id, vector_id, ret);
return ret;
}

return 0;
Expand Down

0 comments on commit f20ccda

Please sign in to comment.