net/mlx5: Improve driver log messages
authorSaeed Mahameed <saeedm@mellanox.com>
Thu, 28 Jul 2016 13:43:17 +0000 (16:43 +0300)
committerLeon Romanovsky <leon@kernel.org>
Wed, 17 Aug 2016 14:45:59 +0000 (17:45 +0300)
Remove duplicate pci dev name printing in mlx5_core_err.
Use mlx5_core_{warn,info,err} where possible to have the pci info in the
driver log messages.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Parvi Kaustubhi <parvik@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
drivers/net/ethernet/mellanox/mlx5/core/sriov.c

index 1c7d8b8314bf43cc084aad96f5d4515dedfc36f3..681c12c14005dee9beae64f78af8496ecd21baf8 100644 (file)
@@ -416,8 +416,8 @@ int mlx5e_vport_rep_load(struct mlx5_eswitch *esw,
 {
        rep->priv_data = mlx5e_create_netdev(esw->dev, &mlx5e_rep_profile, rep);
        if (!rep->priv_data) {
-               pr_warn("Failed to create representor for vport %d\n",
-                       rep->vport);
+               mlx5_core_warn(esw->dev, "Failed to create representor for vport %d\n",
+                              rep->vport);
                return -EINVAL;
        }
        return 0;
index 0a364bf2cd7129a5dba0c12b52c32b3c07e0fae5..7c4935993b99e93a4795a450df708f867b4eeeca 100644 (file)
@@ -306,7 +306,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
 
        spec = mlx5_vzalloc(sizeof(*spec));
        if (!spec) {
-               pr_warn("FDB: Failed to alloc match parameters\n");
+               esw_warn(esw->dev, "FDB: Failed to alloc match parameters\n");
                return NULL;
        }
        dmac_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
@@ -340,8 +340,8 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
                                   MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
                                   0, &dest);
        if (IS_ERR(flow_rule)) {
-               pr_warn(
-                       "FDB: Failed to add flow rule: dmac_v(%pM) dmac_c(%pM) -> vport(%d), err(%ld)\n",
+               esw_warn(esw->dev,
+                        "FDB: Failed to add flow rule: dmac_v(%pM) dmac_c(%pM) -> vport(%d), err(%ld)\n",
                         dmac_v, dmac_c, vport, PTR_ERR(flow_rule));
                flow_rule = NULL;
        }
@@ -1318,8 +1318,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
                                   0, NULL);
        if (IS_ERR(vport->ingress.allow_rule)) {
                err = PTR_ERR(vport->ingress.allow_rule);
-               pr_warn("vport[%d] configure ingress allow rule, err(%d)\n",
-                       vport->vport, err);
+               esw_warn(esw->dev,
+                        "vport[%d] configure ingress allow rule, err(%d)\n",
+                        vport->vport, err);
                vport->ingress.allow_rule = NULL;
                goto out;
        }
@@ -1331,8 +1332,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
                                   0, NULL);
        if (IS_ERR(vport->ingress.drop_rule)) {
                err = PTR_ERR(vport->ingress.drop_rule);
-               pr_warn("vport[%d] configure ingress drop rule, err(%d)\n",
-                       vport->vport, err);
+               esw_warn(esw->dev,
+                        "vport[%d] configure ingress drop rule, err(%d)\n",
+                        vport->vport, err);
                vport->ingress.drop_rule = NULL;
                goto out;
        }
@@ -1384,8 +1386,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
                                   0, NULL);
        if (IS_ERR(vport->egress.allowed_vlan)) {
                err = PTR_ERR(vport->egress.allowed_vlan);
-               pr_warn("vport[%d] configure egress allowed vlan rule failed, err(%d)\n",
-                       vport->vport, err);
+               esw_warn(esw->dev,
+                        "vport[%d] configure egress allowed vlan rule failed, err(%d)\n",
+                        vport->vport, err);
                vport->egress.allowed_vlan = NULL;
                goto out;
        }
@@ -1398,8 +1401,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
                                   0, NULL);
        if (IS_ERR(vport->egress.drop_rule)) {
                err = PTR_ERR(vport->egress.drop_rule);
-               pr_warn("vport[%d] configure egress drop rule failed, err(%d)\n",
-                       vport->vport, err);
+               esw_warn(esw->dev,
+                        "vport[%d] configure egress drop rule failed, err(%d)\n",
+                        vport->vport, err);
                vport->egress.drop_rule = NULL;
        }
 out:
index 75bb8c8645575058324c4807356586055f13da3b..243efc5a8bd1753c942b2eee7e225038a2952d0b 100644 (file)
@@ -345,7 +345,7 @@ static void del_flow_table(struct fs_node *node)
 
        err = mlx5_cmd_destroy_flow_table(dev, ft);
        if (err)
-               pr_warn("flow steering can't destroy ft\n");
+               mlx5_core_warn(dev, "flow steering can't destroy ft\n");
        fs_get_obj(prio, ft->node.parent);
        prio->num_ft--;
 }
@@ -364,7 +364,7 @@ static void del_rule(struct fs_node *node)
 
        match_value = mlx5_vzalloc(match_len);
        if (!match_value) {
-               pr_warn("failed to allocate inbox\n");
+               mlx5_core_warn(dev, "failed to allocate inbox\n");
                return;
        }
 
@@ -387,8 +387,9 @@ static void del_rule(struct fs_node *node)
                                          modify_mask,
                                          fte);
                if (err)
-                       pr_warn("%s can't del rule fg id=%d fte_index=%d\n",
-                               __func__, fg->id, fte->index);
+                       mlx5_core_warn(dev,
+                                      "%s can't del rule fg id=%d fte_index=%d\n",
+                                      __func__, fg->id, fte->index);
        }
        kvfree(match_value);
 }
@@ -409,8 +410,9 @@ static void del_fte(struct fs_node *node)
        err = mlx5_cmd_delete_fte(dev, ft,
                                  fte->index);
        if (err)
-               pr_warn("flow steering can't delete fte in index %d of flow group id %d\n",
-                       fte->index, fg->id);
+               mlx5_core_warn(dev,
+                              "flow steering can't delete fte in index %d of flow group id %d\n",
+                              fte->index, fg->id);
 
        fte->status = 0;
        fg->num_ftes--;
@@ -427,8 +429,8 @@ static void del_flow_group(struct fs_node *node)
        dev = get_dev(&ft->node);
 
        if (mlx5_cmd_destroy_flow_group(dev, ft, fg->id))
-               pr_warn("flow steering can't destroy fg %d of ft %d\n",
-                       fg->id, ft->id);
+               mlx5_core_warn(dev, "flow steering can't destroy fg %d of ft %d\n",
+                              fg->id, ft->id);
 }
 
 static struct fs_fte *alloc_fte(u8 action,
index 7fd662236061b54ba2260e038d0b853ae5ffc63b..d6446a3623b2b327c5861acd7253c2576e149382 100644 (file)
@@ -324,7 +324,7 @@ enum {
                                MLX5_DEV_CAP_FLAG_DCT,
 };
 
-static u16 to_fw_pkey_sz(u32 size)
+static u16 to_fw_pkey_sz(struct mlx5_core_dev *dev, u32 size)
 {
        switch (size) {
        case 128:
@@ -340,7 +340,7 @@ static u16 to_fw_pkey_sz(u32 size)
        case 4096:
                return 5;
        default:
-               pr_warn("invalid pkey table size %d\n", size);
+               mlx5_core_warn(dev, "invalid pkey table size %d\n", size);
                return 0;
        }
 }
@@ -477,7 +477,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
                      128);
        /* we limit the size of the pkey table to 128 entries for now */
        MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size,
-                to_fw_pkey_sz(128));
+                to_fw_pkey_sz(dev, 128));
 
        if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
                MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
@@ -1312,8 +1312,9 @@ static int init_one(struct pci_dev *pdev,
        pci_set_drvdata(pdev, dev);
 
        if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profile)) {
-               pr_warn("selected profile out of range, selecting default (%d)\n",
-                       MLX5_DEFAULT_PROF);
+               mlx5_core_warn(dev,
+                              "selected profile out of range, selecting default (%d)\n",
+                              MLX5_DEFAULT_PROF);
                prof_sel = MLX5_DEFAULT_PROF;
        }
        dev->profile = &profile[prof_sel];
index 14242f17a3096917631e6a09abbed90099837156..ef0eeedcceb655139dfb751a7808b19f46d14c12 100644 (file)
@@ -58,8 +58,8 @@ do {                                                                  \
 } while (0)
 
 #define mlx5_core_err(__dev, format, ...)                              \
-       dev_err(&(__dev)->pdev->dev, "%s:%s:%d:(pid %d): " format,      \
-              (__dev)->priv.name, __func__, __LINE__, current->pid,    \
+       dev_err(&(__dev)->pdev->dev, "%s:%d:(pid %d): " format, \
+               __func__, __LINE__, current->pid,       \
               ##__VA_ARGS__)
 
 #define mlx5_core_warn(__dev, format, ...)                             \
index b380a6bc1f855223c0af19d9db28adb9c8150876..0680dfb4bb1eeff15b4c30a6fe3d0bb003ddaada 100644 (file)
@@ -155,13 +155,13 @@ int mlx5_core_sriov_configure(struct pci_dev *pdev, int num_vfs)
                if (!pci_vfs_assigned(pdev))
                        pci_disable_sriov(pdev);
                else
-                       pr_info("unloading PF driver while leaving orphan VFs\n");
+                       mlx5_core_info(dev, "unloading PF driver while leaving orphan VFs\n");
                return 0;
        }
 
        err = mlx5_core_sriov_enable(pdev, num_vfs);
        if (err) {
-               dev_warn(&pdev->dev, "mlx5_core_sriov_enable failed %d\n", err);
+               mlx5_core_warn(dev, "mlx5_core_sriov_enable failed %d\n", err);
                return err;
        }
 
@@ -180,7 +180,8 @@ static int sync_required(struct pci_dev *pdev)
        int cur_vfs = pci_num_vf(pdev);
 
        if (cur_vfs != sriov->num_vfs) {
-               pr_info("current VFs %d, registered %d - sync needed\n", cur_vfs, sriov->num_vfs);
+               mlx5_core_warn(dev, "current VFs %d, registered %d - sync needed\n",
+                              cur_vfs, sriov->num_vfs);
                return 1;
        }