提交 2974ab6e 编写于 作者: S Saeed Mahameed 提交者: Leon Romanovsky

net/mlx5: Improve driver log messages

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: NSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: NParvi Kaustubhi <parvik@mellanox.com>
Signed-off-by: NLeon Romanovsky <leon@kernel.org>
上级 c4f287c4
...@@ -416,8 +416,8 @@ int mlx5e_vport_rep_load(struct mlx5_eswitch *esw, ...@@ -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); rep->priv_data = mlx5e_create_netdev(esw->dev, &mlx5e_rep_profile, rep);
if (!rep->priv_data) { if (!rep->priv_data) {
pr_warn("Failed to create representor for vport %d\n", mlx5_core_warn(esw->dev, "Failed to create representor for vport %d\n",
rep->vport); rep->vport);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
......
...@@ -306,7 +306,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule, ...@@ -306,7 +306,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
spec = mlx5_vzalloc(sizeof(*spec)); spec = mlx5_vzalloc(sizeof(*spec));
if (!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; return NULL;
} }
dmac_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, 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, ...@@ -340,8 +340,8 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
0, &dest); 0, &dest);
if (IS_ERR(flow_rule)) { if (IS_ERR(flow_rule)) {
pr_warn( esw_warn(esw->dev,
"FDB: Failed to add flow rule: dmac_v(%pM) dmac_c(%pM) -> vport(%d), err(%ld)\n", "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)); dmac_v, dmac_c, vport, PTR_ERR(flow_rule));
flow_rule = NULL; flow_rule = NULL;
} }
...@@ -1318,8 +1318,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, ...@@ -1318,8 +1318,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
0, NULL); 0, NULL);
if (IS_ERR(vport->ingress.allow_rule)) { if (IS_ERR(vport->ingress.allow_rule)) {
err = PTR_ERR(vport->ingress.allow_rule); err = PTR_ERR(vport->ingress.allow_rule);
pr_warn("vport[%d] configure ingress allow rule, err(%d)\n", esw_warn(esw->dev,
vport->vport, err); "vport[%d] configure ingress allow rule, err(%d)\n",
vport->vport, err);
vport->ingress.allow_rule = NULL; vport->ingress.allow_rule = NULL;
goto out; goto out;
} }
...@@ -1331,8 +1332,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, ...@@ -1331,8 +1332,9 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
0, NULL); 0, NULL);
if (IS_ERR(vport->ingress.drop_rule)) { if (IS_ERR(vport->ingress.drop_rule)) {
err = PTR_ERR(vport->ingress.drop_rule); err = PTR_ERR(vport->ingress.drop_rule);
pr_warn("vport[%d] configure ingress drop rule, err(%d)\n", esw_warn(esw->dev,
vport->vport, err); "vport[%d] configure ingress drop rule, err(%d)\n",
vport->vport, err);
vport->ingress.drop_rule = NULL; vport->ingress.drop_rule = NULL;
goto out; goto out;
} }
...@@ -1384,8 +1386,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, ...@@ -1384,8 +1386,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
0, NULL); 0, NULL);
if (IS_ERR(vport->egress.allowed_vlan)) { if (IS_ERR(vport->egress.allowed_vlan)) {
err = PTR_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", esw_warn(esw->dev,
vport->vport, err); "vport[%d] configure egress allowed vlan rule failed, err(%d)\n",
vport->vport, err);
vport->egress.allowed_vlan = NULL; vport->egress.allowed_vlan = NULL;
goto out; goto out;
} }
...@@ -1398,8 +1401,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, ...@@ -1398,8 +1401,9 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
0, NULL); 0, NULL);
if (IS_ERR(vport->egress.drop_rule)) { if (IS_ERR(vport->egress.drop_rule)) {
err = PTR_ERR(vport->egress.drop_rule); err = PTR_ERR(vport->egress.drop_rule);
pr_warn("vport[%d] configure egress drop rule failed, err(%d)\n", esw_warn(esw->dev,
vport->vport, err); "vport[%d] configure egress drop rule failed, err(%d)\n",
vport->vport, err);
vport->egress.drop_rule = NULL; vport->egress.drop_rule = NULL;
} }
out: out:
......
...@@ -345,7 +345,7 @@ static void del_flow_table(struct fs_node *node) ...@@ -345,7 +345,7 @@ static void del_flow_table(struct fs_node *node)
err = mlx5_cmd_destroy_flow_table(dev, ft); err = mlx5_cmd_destroy_flow_table(dev, ft);
if (err) 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); fs_get_obj(prio, ft->node.parent);
prio->num_ft--; prio->num_ft--;
} }
...@@ -364,7 +364,7 @@ static void del_rule(struct fs_node *node) ...@@ -364,7 +364,7 @@ static void del_rule(struct fs_node *node)
match_value = mlx5_vzalloc(match_len); match_value = mlx5_vzalloc(match_len);
if (!match_value) { if (!match_value) {
pr_warn("failed to allocate inbox\n"); mlx5_core_warn(dev, "failed to allocate inbox\n");
return; return;
} }
...@@ -387,8 +387,9 @@ static void del_rule(struct fs_node *node) ...@@ -387,8 +387,9 @@ static void del_rule(struct fs_node *node)
modify_mask, modify_mask,
fte); fte);
if (err) if (err)
pr_warn("%s can't del rule fg id=%d fte_index=%d\n", mlx5_core_warn(dev,
__func__, fg->id, fte->index); "%s can't del rule fg id=%d fte_index=%d\n",
__func__, fg->id, fte->index);
} }
kvfree(match_value); kvfree(match_value);
} }
...@@ -409,8 +410,9 @@ static void del_fte(struct fs_node *node) ...@@ -409,8 +410,9 @@ static void del_fte(struct fs_node *node)
err = mlx5_cmd_delete_fte(dev, ft, err = mlx5_cmd_delete_fte(dev, ft,
fte->index); fte->index);
if (err) if (err)
pr_warn("flow steering can't delete fte in index %d of flow group id %d\n", mlx5_core_warn(dev,
fte->index, fg->id); "flow steering can't delete fte in index %d of flow group id %d\n",
fte->index, fg->id);
fte->status = 0; fte->status = 0;
fg->num_ftes--; fg->num_ftes--;
...@@ -427,8 +429,8 @@ static void del_flow_group(struct fs_node *node) ...@@ -427,8 +429,8 @@ static void del_flow_group(struct fs_node *node)
dev = get_dev(&ft->node); dev = get_dev(&ft->node);
if (mlx5_cmd_destroy_flow_group(dev, ft, fg->id)) if (mlx5_cmd_destroy_flow_group(dev, ft, fg->id))
pr_warn("flow steering can't destroy fg %d of ft %d\n", mlx5_core_warn(dev, "flow steering can't destroy fg %d of ft %d\n",
fg->id, ft->id); fg->id, ft->id);
} }
static struct fs_fte *alloc_fte(u8 action, static struct fs_fte *alloc_fte(u8 action,
......
...@@ -324,7 +324,7 @@ enum { ...@@ -324,7 +324,7 @@ enum {
MLX5_DEV_CAP_FLAG_DCT, 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) { switch (size) {
case 128: case 128:
...@@ -340,7 +340,7 @@ static u16 to_fw_pkey_sz(u32 size) ...@@ -340,7 +340,7 @@ static u16 to_fw_pkey_sz(u32 size)
case 4096: case 4096:
return 5; return 5;
default: default:
pr_warn("invalid pkey table size %d\n", size); mlx5_core_warn(dev, "invalid pkey table size %d\n", size);
return 0; return 0;
} }
} }
...@@ -477,7 +477,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) ...@@ -477,7 +477,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
128); 128);
/* we limit the size of the pkey table to 128 entries for now */ /* we limit the size of the pkey table to 128 entries for now */
MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size, 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) if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
...@@ -1312,8 +1312,9 @@ static int init_one(struct pci_dev *pdev, ...@@ -1312,8 +1312,9 @@ static int init_one(struct pci_dev *pdev,
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profile)) { if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profile)) {
pr_warn("selected profile out of range, selecting default (%d)\n", mlx5_core_warn(dev,
MLX5_DEFAULT_PROF); "selected profile out of range, selecting default (%d)\n",
MLX5_DEFAULT_PROF);
prof_sel = MLX5_DEFAULT_PROF; prof_sel = MLX5_DEFAULT_PROF;
} }
dev->profile = &profile[prof_sel]; dev->profile = &profile[prof_sel];
......
...@@ -58,8 +58,8 @@ do { \ ...@@ -58,8 +58,8 @@ do { \
} while (0) } while (0)
#define mlx5_core_err(__dev, format, ...) \ #define mlx5_core_err(__dev, format, ...) \
dev_err(&(__dev)->pdev->dev, "%s:%s:%d:(pid %d): " format, \ dev_err(&(__dev)->pdev->dev, "%s:%d:(pid %d): " format, \
(__dev)->priv.name, __func__, __LINE__, current->pid, \ __func__, __LINE__, current->pid, \
##__VA_ARGS__) ##__VA_ARGS__)
#define mlx5_core_warn(__dev, format, ...) \ #define mlx5_core_warn(__dev, format, ...) \
......
...@@ -155,13 +155,13 @@ int mlx5_core_sriov_configure(struct pci_dev *pdev, int num_vfs) ...@@ -155,13 +155,13 @@ int mlx5_core_sriov_configure(struct pci_dev *pdev, int num_vfs)
if (!pci_vfs_assigned(pdev)) if (!pci_vfs_assigned(pdev))
pci_disable_sriov(pdev); pci_disable_sriov(pdev);
else 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; return 0;
} }
err = mlx5_core_sriov_enable(pdev, num_vfs); err = mlx5_core_sriov_enable(pdev, num_vfs);
if (err) { 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; return err;
} }
...@@ -180,7 +180,8 @@ static int sync_required(struct pci_dev *pdev) ...@@ -180,7 +180,8 @@ static int sync_required(struct pci_dev *pdev)
int cur_vfs = pci_num_vf(pdev); int cur_vfs = pci_num_vf(pdev);
if (cur_vfs != sriov->num_vfs) { 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; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册