]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 12:18:36 +0000 (14:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1787477
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>
(cherry picked from commit b204bc74840080136bf11643e998dc83afc2c11e)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index e4b6226f9b474aa0730dfe0356d5035f463e0f0b..7636bff80fea69161ebb40d03499a7ba02ae10c3 100644 (file)
@@ -552,24 +552,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 +
@@ -622,7 +616,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(
@@ -640,7 +644,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",