Unify prints in mlx5en(4).

All prints in mlx5en(4) should use on of the macros:
mlx5_en_err/dbg/warn

Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2019-10-02 09:49:44 +00:00
parent a2f4f59ca8
commit 6b4040d8ff
6 changed files with 132 additions and 120 deletions

View File

@ -143,6 +143,21 @@ struct mlx5e_cq;
typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *);
#define mlx5_en_err(_dev, format, ...) \
if_printf(_dev, "ERR: ""%s:%d:(pid %d): " format, \
__func__, __LINE__, curthread->td_proc->p_pid, \
##__VA_ARGS__)
#define mlx5_en_warn(_dev, format, ...) \
if_printf(_dev, "WARN: ""%s:%d:(pid %d): " format, \
__func__, __LINE__, curthread->td_proc->p_pid, \
##__VA_ARGS__)
#define mlx5_en_info(_dev, format, ...) \
if_printf(_dev, "INFO: ""%s:%d:(pid %d): " format, \
__func__, __LINE__, curthread->td_proc->p_pid, \
##__VA_ARGS__)
#define MLX5E_STATS_COUNT(a, ...) a #define MLX5E_STATS_COUNT(a, ...) a
#define MLX5E_STATS_VAR(a, b, c, ...) b c; #define MLX5E_STATS_VAR(a, b, c, ...) b c;
#define MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e, #define MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e,

View File

@ -684,7 +684,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
} else { } else {
priv->params.hw_lro_en = false; priv->params.hw_lro_en = false;
if_printf(priv->ifp, "To enable HW LRO " mlx5_en_warn(priv->ifp, "To enable HW LRO "
"please also enable LRO via ifconfig(8).\n"); "please also enable LRO via ifconfig(8).\n");
} }
} else { } else {
@ -824,8 +824,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct mlx5e_eeprom *eeprom)
ret = mlx5_query_module_num(dev, &eeprom->module_num); ret = mlx5_query_module_num(dev, &eeprom->module_num);
if (ret) { if (ret) {
if_printf(priv->ifp, "%s:%d: Failed query module error=%d\n", mlx5_en_err(priv->ifp, "Failed query module error=%d\n",
__func__, __LINE__, ret); ret);
return (ret); return (ret);
} }
@ -834,8 +834,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct mlx5e_eeprom *eeprom)
eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data, eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data,
&size_read); &size_read);
if (ret) { if (ret) {
if_printf(priv->ifp, "%s:%d: Failed query eeprom module error=0x%x\n", mlx5_en_err(priv->ifp,
__func__, __LINE__, ret); "Failed query eeprom module error=0x%x\n", ret);
return (ret); return (ret);
} }
@ -862,8 +862,9 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct mlx5e_eeprom *eeprom)
eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN; eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN;
break; break;
default: default:
if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n", mlx5_en_err(priv->ifp,
__func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK, "Not recognized cable type = 0x%x(%s)\n",
data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK,
sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]); sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]);
return (EINVAL); return (EINVAL);
} }
@ -887,8 +888,8 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e_eeprom *ee)
ee->len - ee->device_addr, ee->module_num, ee->len - ee->device_addr, ee->module_num,
ee->data + (ee->device_addr / 4), &size_read); ee->data + (ee->device_addr / 4), &size_read);
if (ret) { if (ret) {
if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " mlx5_en_err(priv->ifp,
"error = 0x%02x\n", __func__, __LINE__, ret); "Failed reading eeprom, error = 0x%02x\n",ret);
return (ret); return (ret);
} }
ee->device_addr += size_read; ee->device_addr += size_read;
@ -906,8 +907,9 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e_eeprom *ee)
((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4), ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4),
&size_read); &size_read);
if (ret) { if (ret) {
if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " mlx5_en_err(priv->ifp,
"error = 0x%02x\n", __func__, __LINE__, ret); "Failed reading eeprom, error = 0x%02x\n",
ret);
return (ret); return (ret);
} }
ee->device_addr += size_read; ee->device_addr += size_read;
@ -983,8 +985,8 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
/* Read three first bytes to get important info */ /* Read three first bytes to get important info */
error = mlx5e_get_eeprom_info(priv, &eeprom); error = mlx5e_get_eeprom_info(priv, &eeprom);
if (error) { if (error) {
if_printf(priv->ifp, "%s:%d: Failed reading eeprom's " mlx5_en_err(priv->ifp,
"initial information\n", __func__, __LINE__); "Failed reading eeprom's initial information\n");
error = 0; error = 0;
goto done; goto done;
} }
@ -998,8 +1000,7 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
/* Read the whole eeprom information */ /* Read the whole eeprom information */
error = mlx5e_get_eeprom(priv, &eeprom); error = mlx5e_get_eeprom(priv, &eeprom);
if (error) { if (error) {
if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n", mlx5_en_err(priv->ifp, "Failed reading eeprom\n");
__func__, __LINE__);
error = 0; error = 0;
/* /*
* Continue printing partial information in case of * Continue printing partial information in case of

View File

@ -436,7 +436,7 @@ mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv,
match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
if (!match_value || !match_criteria) { if (!match_value || !match_criteria) {
if_printf(priv->ifp, "%s: alloc failed\n", __func__); mlx5_en_err(priv->ifp, "alloc failed\n");
err = -ENOMEM; err = -ENOMEM;
goto add_eth_addr_rule_out; goto add_eth_addr_rule_out;
} }
@ -467,7 +467,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx5e_priv *priv)
max_list_size = 1 << MLX5_CAP_GEN(priv->mdev, log_max_vlan_list); max_list_size = 1 << MLX5_CAP_GEN(priv->mdev, log_max_vlan_list);
if (list_size > max_list_size) { if (list_size > max_list_size) {
if_printf(ifp, mlx5_en_err(ifp,
"ifnet vlans list size (%d) > (%d) max vport list size, some vlans will be dropped\n", "ifnet vlans list size (%d) > (%d) max vport list size, some vlans will be dropped\n",
list_size, max_list_size); list_size, max_list_size);
list_size = max_list_size; list_size = max_list_size;
@ -486,7 +486,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx5e_priv *priv)
err = mlx5_modify_nic_vport_vlans(priv->mdev, vlans, list_size); err = mlx5_modify_nic_vport_vlans(priv->mdev, vlans, list_size);
if (err) if (err)
if_printf(ifp, "Failed to modify vport vlans list err(%d)\n", mlx5_en_err(ifp, "Failed to modify vport vlans list err(%d)\n",
err); err);
kfree(vlans); kfree(vlans);
@ -549,7 +549,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv,
if (IS_ERR(*rule_p)) { if (IS_ERR(*rule_p)) {
err = PTR_ERR(*rule_p); err = PTR_ERR(*rule_p);
*rule_p = NULL; *rule_p = NULL;
if_printf(priv->ifp, "%s: add rule failed\n", __func__); mlx5_en_err(priv->ifp, "add rule failed\n");
} }
return (err); return (err);
@ -566,7 +566,7 @@ mlx5e_add_vlan_rule(struct mlx5e_priv *priv,
match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
if (!match_value || !match_criteria) { if (!match_value || !match_criteria) {
if_printf(priv->ifp, "%s: alloc failed\n", __func__); mlx5_en_err(priv->ifp, "alloc failed\n");
err = -ENOMEM; err = -ENOMEM;
goto add_vlan_rule_out; goto add_vlan_rule_out;
} }
@ -948,7 +948,7 @@ static void mlx5e_vport_context_update_addr_list(struct mlx5e_priv *priv,
size++; size++;
if (size > max_size) { if (size > max_size) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"ifp %s list size (%d) > (%d) max vport list size, some addresses will be dropped\n", "ifp %s list size (%d) > (%d) max vport list size, some addresses will be dropped\n",
is_uc ? "UC" : "MC", size, max_size); is_uc ? "UC" : "MC", size, max_size);
size = max_size; size = max_size;
@ -966,7 +966,7 @@ static void mlx5e_vport_context_update_addr_list(struct mlx5e_priv *priv,
err = mlx5_modify_nic_vport_mac_list(priv->mdev, list_type, addr_array, size); err = mlx5_modify_nic_vport_mac_list(priv->mdev, list_type, addr_array, size);
out: out:
if (err) if (err)
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"Failed to modify vport %s list err(%d)\n", "Failed to modify vport %s list err(%d)\n",
is_uc ? "UC" : "MC", err); is_uc ? "UC" : "MC", err);
kfree(addr_array); kfree(addr_array);

View File

@ -429,8 +429,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
if (error) { if (error) {
priv->media_active_last = IFM_ETHER; priv->media_active_last = IFM_ETHER;
priv->ifp->if_baudrate = 1; priv->ifp->if_baudrate = 1;
if_printf(priv->ifp, "%s: query port ptys failed: " mlx5_en_err(priv->ifp, "query port ptys failed: 0x%x\n",
"0x%x\n", __func__, error); error);
return; return;
} }
@ -448,8 +448,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
} }
if (media_entry.subtype == 0) { if (media_entry.subtype == 0) {
if_printf(priv->ifp, "%s: Could not find operational " mlx5_en_err(priv->ifp,
"media subtype\n", __func__); "Could not find operational media subtype\n");
return; return;
} }
@ -457,8 +457,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
case IFM_10G_ER: case IFM_10G_ER:
error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, "%s: query port pddr failed: %d\n", mlx5_en_err(priv->ifp,
__func__, error); "query port pddr failed: %d\n", error);
} }
if (error != 0 || is_er_type == 0) if (error != 0 || is_er_type == 0)
media_entry.subtype = IFM_10G_LR; media_entry.subtype = IFM_10G_LR;
@ -466,8 +466,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
case IFM_40G_LR4: case IFM_40G_LR4:
error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, "%s: query port pddr failed: %d\n", mlx5_en_err(priv->ifp,
__func__, error); "query port pddr failed: %d\n", error);
} }
if (error == 0 && is_er_type != 0) if (error == 0 && is_er_type != 0)
media_entry.subtype = IFM_40G_ER4; media_entry.subtype = IFM_40G_ER4;
@ -546,9 +546,8 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv)
error = -ENXIO; error = -ENXIO;
} else if (priv->params.rx_pauseframe_control || } else if (priv->params.rx_pauseframe_control ||
priv->params.tx_pauseframe_control) { priv->params.tx_pauseframe_control) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"Global pauseframes must be disabled before " "Global pauseframes must be disabled before enabling PFC.\n");
"enabling PFC.\n");
error = -EINVAL; error = -EINVAL;
} else { } else {
error = mlx5e_set_port_pause_and_pfc(priv); error = mlx5e_set_port_pause_and_pfc(priv);
@ -581,7 +580,7 @@ mlx5e_media_change(struct ifnet *dev)
error = mlx5_query_port_ptys(mdev, out, sizeof(out), error = mlx5_query_port_ptys(mdev, out, sizeof(out),
MLX5_PTYS_EN, 1); MLX5_PTYS_EN, 1);
if (error != 0) { if (error != 0) {
if_printf(dev, "Query port media capability failed\n"); mlx5_en_err(dev, "Query port media capability failed\n");
goto done; goto done;
} }
@ -596,14 +595,14 @@ mlx5e_media_change(struct ifnet *dev)
if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) { if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) {
link_mode = eth_proto_cap; link_mode = eth_proto_cap;
if (link_mode == 0) { if (link_mode == 0) {
if_printf(dev, "Port media capability is zero\n"); mlx5_en_err(dev, "Port media capability is zero\n");
error = EINVAL; error = EINVAL;
goto done; goto done;
} }
} else { } else {
link_mode = link_mode & eth_proto_cap; link_mode = link_mode & eth_proto_cap;
if (link_mode == 0) { if (link_mode == 0) {
if_printf(dev, "Not supported link mode requested\n"); mlx5_en_err(dev, "Not supported link mode requested\n");
error = EINVAL; error = EINVAL;
goto done; goto done;
} }
@ -612,7 +611,7 @@ mlx5e_media_change(struct ifnet *dev)
/* check if PFC is enabled */ /* check if PFC is enabled */
if (priv->params.rx_priority_flow_control || if (priv->params.rx_priority_flow_control ||
priv->params.tx_priority_flow_control) { priv->params.tx_priority_flow_control) {
if_printf(dev, "PFC must be disabled before enabling global pauseframes.\n"); mlx5_en_err(dev, "PFC must be disabled before enabling global pauseframes.\n");
error = EINVAL; error = EINVAL;
goto done; goto done;
} }
@ -1021,7 +1020,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL, priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL,
priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL); priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL);
if (error != 0) if (error != 0)
if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); mlx5_en_err(priv->ifp,
"Failed reading diagnostics: %d\n", error);
} }
} }
@ -1173,8 +1173,8 @@ mlx5e_calibration_callout(void *arg)
if (((next->clbr_hw_curr - curr->clbr_hw_curr) >> MLX5E_TSTMP_PREC) == if (((next->clbr_hw_curr - curr->clbr_hw_curr) >> MLX5E_TSTMP_PREC) ==
0) { 0) {
if (priv->clbr_done != 0) { if (priv->clbr_done != 0) {
if_printf(priv->ifp, "HW failed tstmp frozen %#jx %#jx," mlx5_en_err(priv->ifp,
"disabling\n", "HW failed tstmp frozen %#jx %#jx, disabling\n",
next->clbr_hw_curr, curr->clbr_hw_prev); next->clbr_hw_curr, curr->clbr_hw_prev);
priv->clbr_done = 0; priv->clbr_done = 0;
} }
@ -1872,7 +1872,7 @@ mlx5e_drain_sq(struct mlx5e_sq *sq)
/* error out remaining requests */ /* error out remaining requests */
error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
if (error != 0) { if (error != 0) {
if_printf(sq->ifp, mlx5_en_err(sq->ifp,
"mlx5e_modify_sq() from RDY to ERR failed: %d\n", error); "mlx5e_modify_sq() from RDY to ERR failed: %d\n", error);
} }
@ -2936,16 +2936,17 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int sw_mtu)
err = mlx5_set_port_mtu(mdev, hw_mtu); err = mlx5_set_port_mtu(mdev, hw_mtu);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, err=%d\n", mlx5_en_err(ifp, "mlx5_set_port_mtu failed setting %d, err=%d\n",
__func__, sw_mtu, err); sw_mtu, err);
return (err); return (err);
} }
/* Update vport context MTU */ /* Update vport context MTU */
err = mlx5_set_vport_mtu(mdev, hw_mtu); err = mlx5_set_vport_mtu(mdev, hw_mtu);
if (err) { if (err) {
if_printf(ifp, "%s: Failed updating vport context with MTU size, err=%d\n", mlx5_en_err(ifp,
__func__, err); "Failed updating vport context with MTU size, err=%d\n",
err);
} }
ifp->if_mtu = sw_mtu; ifp->if_mtu = sw_mtu;
@ -2956,17 +2957,19 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int sw_mtu)
err = mlx5_query_port_oper_mtu(mdev, &hw_mtu); err = mlx5_query_port_oper_mtu(mdev, &hw_mtu);
} }
if (err) { if (err) {
if_printf(ifp, "Query port MTU, after setting new " mlx5_en_err(ifp,
"MTU value, failed\n"); "Query port MTU, after setting new MTU value, failed\n");
return (err); return (err);
} else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) { } else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) {
err = -E2BIG, err = -E2BIG,
if_printf(ifp, "Port MTU %d is smaller than " mlx5_en_err(ifp,
"ifp mtu %d\n", hw_mtu, sw_mtu); "Port MTU %d is smaller than ifp mtu %d\n",
hw_mtu, sw_mtu);
} else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) { } else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) {
err = -EINVAL; err = -EINVAL;
if_printf(ifp, "Port MTU %d is bigger than " mlx5_en_err(ifp,
"ifp mtu %d\n", hw_mtu, sw_mtu); "Port MTU %d is bigger than ifp mtu %d\n",
hw_mtu, sw_mtu);
} }
priv->params_ethtool.hw_mtu = hw_mtu; priv->params_ethtool.hw_mtu = hw_mtu;
@ -2986,23 +2989,21 @@ mlx5e_open_locked(struct ifnet *ifp)
#ifdef RSS #ifdef RSS
if (rss_getnumbuckets() > priv->params.num_channels) { if (rss_getnumbuckets() > priv->params.num_channels) {
if_printf(ifp, "NOTE: There are more RSS buckets(%u) than " mlx5_en_info(ifp,
"channels(%u) available\n", rss_getnumbuckets(), "NOTE: There are more RSS buckets(%u) than channels(%u) available\n",
priv->params.num_channels); rss_getnumbuckets(), priv->params.num_channels);
} }
#endif #endif
err = mlx5e_open_tises(priv); err = mlx5e_open_tises(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_open_tises failed, %d\n", mlx5_en_err(ifp, "mlx5e_open_tises failed, %d\n", err);
__func__, err);
return (err); return (err);
} }
err = mlx5_vport_alloc_q_counter(priv->mdev, err = mlx5_vport_alloc_q_counter(priv->mdev,
MLX5_INTERFACE_PROTOCOL_ETH, &set_id); MLX5_INTERFACE_PROTOCOL_ETH, &set_id);
if (err) { if (err) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"%s: mlx5_vport_alloc_q_counter failed: %d\n", "mlx5_vport_alloc_q_counter failed: %d\n", err);
__func__, err);
goto err_close_tises; goto err_close_tises;
} }
/* store counter set ID */ /* store counter set ID */
@ -3010,32 +3011,30 @@ mlx5e_open_locked(struct ifnet *ifp)
err = mlx5e_open_channels(priv); err = mlx5e_open_channels(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_open_channels failed, %d\n", mlx5_en_err(ifp,
__func__, err); "mlx5e_open_channels failed, %d\n", err);
goto err_dalloc_q_counter; goto err_dalloc_q_counter;
} }
err = mlx5e_open_rqt(priv); err = mlx5e_open_rqt(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_open_rqt failed, %d\n", mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err);
__func__, err);
goto err_close_channels; goto err_close_channels;
} }
err = mlx5e_open_tirs(priv); err = mlx5e_open_tirs(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_open_tir failed, %d\n", mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err);
__func__, err);
goto err_close_rqls; goto err_close_rqls;
} }
err = mlx5e_open_flow_table(priv); err = mlx5e_open_flow_table(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_open_flow_table failed, %d\n", mlx5_en_err(ifp,
__func__, err); "mlx5e_open_flow_table failed, %d\n", err);
goto err_close_tirs; goto err_close_tirs;
} }
err = mlx5e_add_all_vlan_rules(priv); err = mlx5e_add_all_vlan_rules(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_add_all_vlan_rules failed, %d\n", mlx5_en_err(ifp,
__func__, err); "mlx5e_add_all_vlan_rules failed, %d\n", err);
goto err_close_flow_table; goto err_close_flow_table;
} }
set_bit(MLX5E_STATE_OPENED, &priv->state); set_bit(MLX5E_STATE_OPENED, &priv->state);
@ -3074,9 +3073,8 @@ mlx5e_open(void *arg)
PRIV_LOCK(priv); PRIV_LOCK(priv);
if (mlx5_set_port_status(priv->mdev, MLX5_PORT_UP)) if (mlx5_set_port_status(priv->mdev, MLX5_PORT_UP))
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"%s: Setting port status to up failed\n", "Setting port status to up failed\n");
__func__);
mlx5e_open_locked(priv->ifp); mlx5e_open_locked(priv->ifp);
priv->ifp->if_drv_flags |= IFF_DRV_RUNNING; priv->ifp->if_drv_flags |= IFF_DRV_RUNNING;
@ -3213,7 +3211,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
mlx5e_open_locked(ifp); mlx5e_open_locked(ifp);
} else { } else {
error = EINVAL; error = EINVAL;
if_printf(ifp, "Invalid MTU value. Min val: %d, Max val: %d\n", mlx5_en_err(ifp,
"Invalid MTU value. Min val: %d, Max val: %d\n",
MLX5E_MTU_MIN, MIN(MLX5E_MTU_MAX, max_mtu)); MLX5E_MTU_MIN, MIN(MLX5E_MTU_MAX, max_mtu));
} }
PRIV_UNLOCK(priv); PRIV_UNLOCK(priv);
@ -3267,7 +3266,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
!(IFCAP_TXCSUM & ifp->if_capenable)) { !(IFCAP_TXCSUM & ifp->if_capenable)) {
ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_capenable &= ~IFCAP_TSO4;
ifp->if_hwassist &= ~CSUM_IP_TSO; ifp->if_hwassist &= ~CSUM_IP_TSO;
if_printf(ifp, mlx5_en_err(ifp,
"tso4 disabled due to -txcsum.\n"); "tso4 disabled due to -txcsum.\n");
} }
} }
@ -3279,7 +3278,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) { !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
ifp->if_capenable &= ~IFCAP_TSO6; ifp->if_capenable &= ~IFCAP_TSO6;
ifp->if_hwassist &= ~CSUM_IP6_TSO; ifp->if_hwassist &= ~CSUM_IP6_TSO;
if_printf(ifp, mlx5_en_err(ifp,
"tso6 disabled due to -txcsum6.\n"); "tso6 disabled due to -txcsum6.\n");
} }
} }
@ -3292,7 +3291,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
if (mask & IFCAP_TSO4) { if (mask & IFCAP_TSO4) {
if (!(IFCAP_TSO4 & ifp->if_capenable) && if (!(IFCAP_TSO4 & ifp->if_capenable) &&
!(IFCAP_TXCSUM & ifp->if_capenable)) { !(IFCAP_TXCSUM & ifp->if_capenable)) {
if_printf(ifp, "enable txcsum first.\n"); mlx5_en_err(ifp, "enable txcsum first.\n");
error = EAGAIN; error = EAGAIN;
goto out; goto out;
} }
@ -3302,7 +3301,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
if (mask & IFCAP_TSO6) { if (mask & IFCAP_TSO6) {
if (!(IFCAP_TSO6 & ifp->if_capenable) && if (!(IFCAP_TSO6 & ifp->if_capenable) &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) { !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
if_printf(ifp, "enable txcsum6 first.\n"); mlx5_en_err(ifp, "enable txcsum6 first.\n");
error = EAGAIN; error = EAGAIN;
goto out; goto out;
} }
@ -3382,8 +3381,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
/* Get module_num which is required for the query_eeprom */ /* Get module_num which is required for the query_eeprom */
error = mlx5_query_module_num(priv->mdev, &module_num); error = mlx5_query_module_num(priv->mdev, &module_num);
if (error) { if (error) {
if_printf(ifp, "Query module num failed, eeprom " mlx5_en_err(ifp,
"reading is not supported\n"); "Query module num failed, eeprom reading is not supported\n");
error = EINVAL; error = EINVAL;
goto err_i2c; goto err_i2c;
} }
@ -3402,8 +3401,9 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
else if (i2c.dev_addr == 0xA2) else if (i2c.dev_addr == 0xA2)
read_addr = MLX5E_I2C_ADDR_HIGH; read_addr = MLX5E_I2C_ADDR_HIGH;
else { else {
if_printf(ifp, "Query eeprom failed, " mlx5_en_err(ifp,
"Invalid Address: %X\n", i2c.dev_addr); "Query eeprom failed, Invalid Address: %X\n",
i2c.dev_addr);
error = EINVAL; error = EINVAL;
goto err_i2c; goto err_i2c;
} }
@ -3412,8 +3412,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
(uint32_t)i2c.offset, (uint32_t)i2c.len, module_num, (uint32_t)i2c.offset, (uint32_t)i2c.len, module_num,
(uint32_t *)i2c.data, &size_read); (uint32_t *)i2c.data, &size_read);
if (error) { if (error) {
if_printf(ifp, "Query eeprom failed, eeprom " mlx5_en_err(ifp,
"reading is not supported\n"); "Query eeprom failed, eeprom reading is not supported\n");
error = EINVAL; error = EINVAL;
goto err_i2c; goto err_i2c;
} }
@ -3426,8 +3426,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
(uint32_t *)(i2c.data + size_read), &size_read); (uint32_t *)(i2c.data + size_read), &size_read);
} }
if (error) { if (error) {
if_printf(ifp, "Query eeprom failed, eeprom " mlx5_en_err(ifp,
"reading is not supported\n"); "Query eeprom failed, eeprom reading is not supported\n");
error = EINVAL; error = EINVAL;
goto err_i2c; goto err_i2c;
} }
@ -3563,7 +3563,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
in = mlx5_vzalloc(inlen); in = mlx5_vzalloc(inlen);
if (in == NULL) { if (in == NULL) {
if_printf(ifp, "%s: failed to allocate inbox\n", __func__); mlx5_en_err(ifp, "failed to allocate inbox\n");
return (-ENOMEM); return (-ENOMEM);
} }
@ -3578,8 +3578,8 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
err = mlx5_core_create_mkey(mdev, mkey, in, inlen); err = mlx5_core_create_mkey(mdev, mkey, in, inlen);
if (err) if (err)
if_printf(ifp, "%s: mlx5_core_create_mkey failed, %d\n", mlx5_en_err(ifp, "mlx5_core_create_mkey failed, %d\n",
__func__, err); err);
kvfree(in); kvfree(in);
return (err); return (err);
@ -3660,7 +3660,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq)
err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_ERR, err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_ERR,
MLX5_SQC_STATE_RST); MLX5_SQC_STATE_RST);
if (err != 0) { if (err != 0) {
if_printf(sq->ifp, mlx5_en_err(sq->ifp,
"mlx5e_modify_sq() from ERR to RST failed: %d\n", err); "mlx5e_modify_sq() from ERR to RST failed: %d\n", err);
} }
@ -3673,7 +3673,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq)
err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RST, err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RST,
MLX5_SQC_STATE_RDY); MLX5_SQC_STATE_RDY);
if (err != 0) { if (err != 0) {
if_printf(sq->ifp, mlx5_en_err(sq->ifp,
"mlx5e_modify_sq() from RST to RDY failed: %d\n", err); "mlx5e_modify_sq() from RST to RDY failed: %d\n", err);
} }
@ -3705,7 +3705,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch)
err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR);
if (err != 0) { if (err != 0) {
if_printf(rq->ifp, mlx5_en_err(rq->ifp,
"mlx5e_modify_rq() from RDY to RST failed: %d\n", err); "mlx5e_modify_rq() from RDY to RST failed: %d\n", err);
} }
@ -3720,7 +3720,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch)
*/ */
err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_ERR, MLX5_RQC_STATE_RST); err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_ERR, MLX5_RQC_STATE_RST);
if (err != 0) { if (err != 0) {
if_printf(rq->ifp, mlx5_en_err(rq->ifp,
"mlx5e_modify_rq() from ERR to RST failed: %d\n", err); "mlx5e_modify_rq() from ERR to RST failed: %d\n", err);
} }
} }
@ -3735,7 +3735,7 @@ mlx5e_enable_rx_dma(struct mlx5e_channel *ch)
mlx5_wq_ll_update_db_record(&rq->wq); mlx5_wq_ll_update_db_record(&rq->wq);
err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RST, MLX5_RQC_STATE_RDY); err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RST, MLX5_RQC_STATE_RDY);
if (err != 0) { if (err != 0) {
if_printf(rq->ifp, mlx5_en_err(rq->ifp,
"mlx5e_modify_rq() from RST to RDY failed: %d\n", err); "mlx5e_modify_rq() from RST to RDY failed: %d\n", err);
} }
@ -3943,7 +3943,7 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv)
/* update firmware */ /* update firmware */
error = mlx5e_set_port_pause_and_pfc(priv); error = mlx5e_set_port_pause_and_pfc(priv);
if (error == -EINVAL) { if (error == -EINVAL) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"Global pauseframes must be disabled before enabling PFC.\n"); "Global pauseframes must be disabled before enabling PFC.\n");
priv->params.rx_priority_flow_control = 0; priv->params.rx_priority_flow_control = 0;
priv->params.tx_priority_flow_control = 0; priv->params.tx_priority_flow_control = 0;
@ -4253,26 +4253,23 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); err = mlx5_alloc_map_uar(mdev, &priv->cq_uar);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n", mlx5_en_err(ifp, "mlx5_alloc_map_uar failed, %d\n", err);
__func__, err);
goto err_free_wq; goto err_free_wq;
} }
err = mlx5_core_alloc_pd(mdev, &priv->pdn); err = mlx5_core_alloc_pd(mdev, &priv->pdn);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5_core_alloc_pd failed, %d\n", mlx5_en_err(ifp, "mlx5_core_alloc_pd failed, %d\n", err);
__func__, err);
goto err_unmap_free_uar; goto err_unmap_free_uar;
} }
err = mlx5_alloc_transport_domain(mdev, &priv->tdn); err = mlx5_alloc_transport_domain(mdev, &priv->tdn);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5_alloc_transport_domain failed, %d\n", mlx5_en_err(ifp,
__func__, err); "mlx5_alloc_transport_domain failed, %d\n", err);
goto err_dealloc_pd; goto err_dealloc_pd;
} }
err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr); err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_create_mkey failed, %d\n", mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err);
__func__, err);
goto err_dealloc_transport_domain; goto err_dealloc_transport_domain;
} }
mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr); mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr);
@ -4281,13 +4278,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
if (MLX5_CAP_GEN(priv->mdev, vport_group_manager) == 0 && if (MLX5_CAP_GEN(priv->mdev, vport_group_manager) == 0 &&
is_zero_ether_addr(dev_addr)) { is_zero_ether_addr(dev_addr)) {
random_ether_addr(dev_addr); random_ether_addr(dev_addr);
if_printf(ifp, "Assigned random MAC address\n"); mlx5_en_err(ifp, "Assigned random MAC address\n");
} }
#ifdef RATELIMIT #ifdef RATELIMIT
err = mlx5e_rl_init(priv); err = mlx5e_rl_init(priv);
if (err) { if (err) {
if_printf(ifp, "%s: mlx5e_rl_init failed, %d\n", mlx5_en_err(ifp, "mlx5e_rl_init failed, %d\n", err);
__func__, err);
goto err_create_mkey; goto err_create_mkey;
} }
#endif #endif
@ -4315,8 +4311,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
connector_type); connector_type);
} else { } else {
eth_proto_cap = 0; eth_proto_cap = 0;
if_printf(ifp, "%s: Query port media capability failed," mlx5_en_err(ifp, "Query port media capability failed, %d\n", err);
" %d\n", __func__, err);
} }
ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK,
@ -4439,8 +4434,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv)
* detaching: * detaching:
*/ */
while (READ_ONCE(priv->rl.stats.tx_active_connections) != 0) { while (READ_ONCE(priv->rl.stats.tx_active_connections) != 0) {
if_printf(priv->ifp, "Waiting for all ratelimit connections " mlx5_en_err(priv->ifp,
"to terminate\n"); "Waiting for all ratelimit connections to terminate\n");
pause("W", hz); pause("W", hz);
} }
#endif #endif
@ -4461,8 +4456,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv)
/* wait for all unlimited send tags to go away */ /* wait for all unlimited send tags to go away */
while (priv->channel_refs != 0) { while (priv->channel_refs != 0) {
if_printf(priv->ifp, "Waiting for all unlimited connections " mlx5_en_err(priv->ifp,
"to terminate\n"); "Waiting for all unlimited connections to terminate\n");
pause("W", hz); pause("W", hz);
} }

View File

@ -518,7 +518,7 @@ mlx5e_rl_worker(void *arg)
MLX5E_RL_WORKER_LOCK(rlw); MLX5E_RL_WORKER_LOCK(rlw);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"mlx5e_rl_open_channel failed: %d\n", error); "mlx5e_rl_open_channel failed: %d\n", error);
break; break;
} }
@ -551,7 +551,7 @@ mlx5e_rl_worker(void *arg)
MLX5E_RL_RUNLOCK(&priv->rl); MLX5E_RL_RUNLOCK(&priv->rl);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"mlx5e_rl_open_channel failed: %d\n", error); "mlx5e_rl_open_channel failed: %d\n", error);
} else { } else {
atomic_add_64(&rlw->priv->rl.stats.tx_open_queues, 1ULL); atomic_add_64(&rlw->priv->rl.stats.tx_open_queues, 1ULL);
@ -565,7 +565,7 @@ mlx5e_rl_worker(void *arg)
error = mlx5e_rlw_channel_set_rate_locked(rlw, channel, error = mlx5e_rlw_channel_set_rate_locked(rlw, channel,
channel->new_rate * 8ULL); channel->new_rate * 8ULL);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"mlx5e_rlw_channel_set_rate_locked failed: %d\n", "mlx5e_rlw_channel_set_rate_locked failed: %d\n",
error); error);
} }
@ -574,7 +574,7 @@ mlx5e_rl_worker(void *arg)
case MLX5E_RL_ST_DESTROY: case MLX5E_RL_ST_DESTROY:
error = mlx5e_rlw_channel_set_rate_locked(rlw, channel, 0); error = mlx5e_rlw_channel_set_rate_locked(rlw, channel, 0);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"mlx5e_rlw_channel_set_rate_locked failed: %d\n", "mlx5e_rlw_channel_set_rate_locked failed: %d\n",
error); error);
} }
@ -855,7 +855,7 @@ mlx5e_rl_init(struct mlx5e_priv *priv)
PRIV_UNLOCK(priv); PRIV_UNLOCK(priv);
if (error != 0) { if (error != 0) {
if_printf(priv->ifp, mlx5_en_err(priv->ifp,
"mlx5e_rl_open_workers failed: %d\n", error); "mlx5e_rl_open_workers failed: %d\n", error);
} }
@ -893,7 +893,7 @@ mlx5e_rl_open_workers(struct mlx5e_priv *priv)
error = kproc_kthread_add(mlx5e_rl_worker, rlw, &rl_proc, &rl_thread, error = kproc_kthread_add(mlx5e_rl_worker, rlw, &rl_proc, &rl_thread,
RFHIGHPID, 0, "mlx5-ratelimit", "mlx5-rl-worker-thread-%d", (int)j); RFHIGHPID, 0, "mlx5-ratelimit", "mlx5-rl-worker-thread-%d", (int)j);
if (error != 0) { if (error != 0) {
if_printf(rl->priv->ifp, mlx5_en_err(rl->priv->ifp,
"kproc_kthread_add failed: %d\n", error); "kproc_kthread_add failed: %d\n", error);
rlw->worker_done = 1; rlw->worker_done = 1;
} }
@ -1089,7 +1089,8 @@ mlx5e_find_available_tx_ring_index(struct mlx5e_rl_worker *rlw,
*pchannel = channel; *pchannel = channel;
#ifdef RATELIMIT_DEBUG #ifdef RATELIMIT_DEBUG
if_printf(rlw->priv->ifp, "Channel pointer for rate limit connection is %p\n", channel); mlx5_en_info(rlw->priv->ifp,
"Channel pointer for rate limit connection is %p\n", channel);
#endif #endif
return (retval); return (retval);
} }

View File

@ -48,6 +48,6 @@ mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int event)
{ {
struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq); struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq);
if_printf(cq->priv->ifp, "%s: cqn=0x%.6x event=0x%.2x\n", mlx5_en_err(cq->priv->ifp, "cqn=0x%.6x event=0x%.2x\n",
__func__, mcq->cqn, event); mcq->cqn, event);
} }