net: hns3: fix misuse vf id and vport id in some logs
authorJiaran Zhang <zhangjiaran@huawei.com>
Wed, 15 Sep 2021 13:52:08 +0000 (21:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Sep 2021 12:28:39 +0000 (13:28 +0100)
vport_id include PF and VFs, vport_id = 0 means PF, other values mean VFs.
So the actual vf id is equal to vport_id minus 1.

Some VF print logs are actually vport, and logs of vf id actually use
vport id, so this patch fixes them.

Fixes: ac887be5b0fe ("net: hns3: change print level of RAS error log from warning to error")
Fixes: adcf738b804b ("net: hns3: cleanup some print format warning")
Signed-off-by: Jiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

index 718c16d..bb9b026 100644 (file)
@@ -2445,12 +2445,12 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev,
                return;
        }
 
-       dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vf_id(%u), queue_id(%u)\n",
+       dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vport(%u), queue_id(%u)\n",
                vf_id, q_id);
 
        if (vf_id) {
                if (vf_id >= hdev->num_alloc_vport) {
-                       dev_err(dev, "invalid vf id(%u)\n", vf_id);
+                       dev_err(dev, "invalid vport(%u)\n", vf_id);
                        return;
                }
 
@@ -2463,8 +2463,8 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev,
 
                ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]);
                if (ret)
-                       dev_err(dev, "inform reset to vf(%u) failed %d!\n",
-                               hdev->vport->vport_id, ret);
+                       dev_err(dev, "inform reset to vport(%u) failed %d!\n",
+                               vf_id, ret);
        } else {
                set_bit(HNAE3_FUNC_RESET, reset_requests);
        }
index c0f25ea..afc88a4 100644 (file)
@@ -3661,7 +3661,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset)
                if (ret) {
                        dev_err(&hdev->pdev->dev,
                                "set vf(%u) rst failed %d!\n",
-                               vport->vport_id, ret);
+                               vport->vport_id - HCLGE_VF_VPORT_START_NUM,
+                               ret);
                        return ret;
                }
 
@@ -3676,7 +3677,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset)
                if (ret)
                        dev_warn(&hdev->pdev->dev,
                                 "inform reset to vf(%u) failed %d!\n",
-                                vport->vport_id, ret);
+                                vport->vport_id - HCLGE_VF_VPORT_START_NUM,
+                                ret);
        }
 
        return 0;
@@ -11467,11 +11469,11 @@ static void hclge_clear_resetting_state(struct hclge_dev *hdev)
                struct hclge_vport *vport = &hdev->vport[i];
                int ret;
 
-                /* Send cmd to clear VF's FUNC_RST_ING */
+                /* Send cmd to clear vport's FUNC_RST_ING */
                ret = hclge_set_vf_rst(hdev, vport->vport_id, false);
                if (ret)
                        dev_warn(&hdev->pdev->dev,
-                                "clear vf(%u) rst failed %d!\n",
+                                "clear vport(%u) rst failed %d!\n",
                                 vport->vport_id, ret);
        }
 }
index 2ce5302..07aa6ad 100644 (file)
@@ -566,7 +566,7 @@ static int hclge_reset_vf(struct hclge_vport *vport)
        struct hclge_dev *hdev = vport->back;
 
        dev_warn(&hdev->pdev->dev, "PF received VF reset request from VF %u!",
-                vport->vport_id);
+                vport->vport_id - HCLGE_VF_VPORT_START_NUM);
 
        return hclge_func_reset_cmd(hdev, vport->vport_id);
 }
index 78d5bf1..44618cc 100644 (file)
@@ -581,7 +581,7 @@ int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate)
                ret = hclge_cmd_send(&hdev->hw, &desc, 1);
                if (ret) {
                        dev_err(&hdev->pdev->dev,
-                               "vf%u, qs%u failed to set tx_rate:%d, ret=%d\n",
+                               "vport%u, qs%u failed to set tx_rate:%d, ret=%d\n",
                                vport->vport_id, shap_cfg_cmd->qs_id,
                                max_tx_rate, ret);
                        return ret;