]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: hns3: remove hclge_get_vector_index from hclge_bind_ring_with_vector
authorPeng Li <lipeng321@huawei.com>
Thu, 28 Jun 2018 04:12:19 +0000 (12:12 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Jun 2018 02:06:34 +0000 (11:06 +0900)
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: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index a17872aab168112e637ba64747d09ee343712e8c..b3d8237b83d9ce0d5490de21eeae3924afbf6c64 100644 (file)
@@ -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,
-                                      int vector,
+                                      int vector_id,
                                       struct hnae3_ring_chain_node *ring_chain)
 {
        struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
        struct hnae3_ring_chain_node *node;
        struct hclge_mbx_vf_to_pf_cmd *req;
        struct hclgevf_desc desc;
-       int i = 0, vector_id;
+       int i = 0;
        int status;
        u8 type;
 
        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) {
                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,
 static int hclgevf_map_ring_to_vector(struct hnae3_handle *handle, int vector,
                                      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(
@@ -635,7 +639,7 @@ static int hclgevf_unmap_ring_from_vector(
                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)
                dev_err(&handle->pdev->dev,
                        "Unmap ring from vector fail. vector=%d, ret =%d\n",