Commit b204bc74 authored by Peng Li's avatar Peng Li Committed by David S. Miller

net: hns3: remove hclge_get_vector_index from hclge_bind_ring_with_vector

In hclge_unmap_ring_frm_vector, there are 2 steps:
step 1: get vector index.
step 2 unbind ring with vector.

But it gets vector id again in step 2 interface. This patch
removes hclge_get_vector_index from hclge_bind_ring_with_vector,
and make the step the same with hns3 PF driver.
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 16c0cd07
...@@ -547,24 +547,18 @@ static int hclgevf_get_tc_size(struct hnae3_handle *handle) ...@@ -547,24 +547,18 @@ static int hclgevf_get_tc_size(struct hnae3_handle *handle)
} }
static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en, static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en,
int vector, int vector_id,
struct hnae3_ring_chain_node *ring_chain) struct hnae3_ring_chain_node *ring_chain)
{ {
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
struct hnae3_ring_chain_node *node; struct hnae3_ring_chain_node *node;
struct hclge_mbx_vf_to_pf_cmd *req; struct hclge_mbx_vf_to_pf_cmd *req;
struct hclgevf_desc desc; struct hclgevf_desc desc;
int i = 0, vector_id; int i = 0;
int status; int status;
u8 type; u8 type;
req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data; req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data;
vector_id = hclgevf_get_vector_index(hdev, vector);
if (vector_id < 0) {
dev_err(&handle->pdev->dev,
"Get vector index fail. ret =%d\n", vector_id);
return vector_id;
}
for (node = ring_chain; node; node = node->next) { for (node = ring_chain; node; node = node->next) {
int idx_offset = HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + int idx_offset = HCLGE_MBX_RING_MAP_BASIC_MSG_NUM +
...@@ -617,7 +611,17 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en, ...@@ -617,7 +611,17 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en,
static int hclgevf_map_ring_to_vector(struct hnae3_handle *handle, int vector, static int hclgevf_map_ring_to_vector(struct hnae3_handle *handle, int vector,
struct hnae3_ring_chain_node *ring_chain) struct hnae3_ring_chain_node *ring_chain)
{ {
return hclgevf_bind_ring_to_vector(handle, true, vector, ring_chain); struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
int vector_id;
vector_id = hclgevf_get_vector_index(hdev, vector);
if (vector_id < 0) {
dev_err(&handle->pdev->dev,
"Get vector index fail. ret =%d\n", vector_id);
return vector_id;
}
return hclgevf_bind_ring_to_vector(handle, true, vector_id, ring_chain);
} }
static int hclgevf_unmap_ring_from_vector( static int hclgevf_unmap_ring_from_vector(
...@@ -635,7 +639,7 @@ static int hclgevf_unmap_ring_from_vector( ...@@ -635,7 +639,7 @@ static int hclgevf_unmap_ring_from_vector(
return vector_id; return vector_id;
} }
ret = hclgevf_bind_ring_to_vector(handle, false, vector, ring_chain); ret = hclgevf_bind_ring_to_vector(handle, false, vector_id, ring_chain);
if (ret) if (ret)
dev_err(&handle->pdev->dev, dev_err(&handle->pdev->dev,
"Unmap ring from vector fail. vector=%d, ret =%d\n", "Unmap ring from vector fail. vector=%d, ret =%d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment