Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2019 09:49:45 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352976 - head/sys/dev/mlx5/mlx5_en
Message-ID:  <201910020949.x929njxv017186@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Oct  2 09:49:44 2019
New Revision: 352976
URL: https://svnweb.freebsd.org/changeset/base/352976

Log:
  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

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/en.h	Wed Oct  2 09:48:01 2019	(r352975)
+++ head/sys/dev/mlx5/mlx5_en/en.h	Wed Oct  2 09:49:44 2019	(r352976)
@@ -143,6 +143,21 @@ struct mlx5e_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_VAR(a, b, c, ...) b c;
 #define	MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e,

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Wed Oct  2 09:48:01 2019	(r352975)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Wed Oct  2 09:49:44 2019	(r352976)
@@ -684,7 +684,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 			} else {
 				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");
 			}
 		} else {
@@ -824,8 +824,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct 
 
 	ret = mlx5_query_module_num(dev, &eeprom->module_num);
 	if (ret) {
-		if_printf(priv->ifp, "%s:%d: Failed query module error=%d\n",
-		    __func__, __LINE__, ret);
+		mlx5_en_err(priv->ifp, "Failed query module error=%d\n",
+		    ret);
 		return (ret);
 	}
 
@@ -834,8 +834,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct 
 	    eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data,
 	    &size_read);
 	if (ret) {
-		if_printf(priv->ifp, "%s:%d: Failed query eeprom module error=0x%x\n",
-		    __func__, __LINE__, ret);
+		mlx5_en_err(priv->ifp,
+		    "Failed query eeprom module error=0x%x\n", ret);
 		return (ret);
 	}
 
@@ -862,8 +862,9 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct 
 		eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN;
 		break;
 	default:
-		if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n",
-		    __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK,
+		mlx5_en_err(priv->ifp,
+		    "Not recognized cable type = 0x%x(%s)\n",
+		    data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK,
 		    sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]);
 		return (EINVAL);
 	}
@@ -887,8 +888,8 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e
 		    ee->len - ee->device_addr, ee->module_num,
 		    ee->data + (ee->device_addr / 4), &size_read);
 		if (ret) {
-			if_printf(priv->ifp, "%s:%d: Failed reading eeprom, "
-			    "error = 0x%02x\n", __func__, __LINE__, ret);
+			mlx5_en_err(priv->ifp,
+			    "Failed reading eeprom, error = 0x%02x\n",ret);
 			return (ret);
 		}
 		ee->device_addr += size_read;
@@ -906,8 +907,9 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e
 			    ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4),
 			    &size_read);
 			if (ret) {
-				if_printf(priv->ifp, "%s:%d: Failed reading eeprom, "
-				    "error = 0x%02x\n", __func__, __LINE__, ret);
+				mlx5_en_err(priv->ifp,
+				    "Failed reading eeprom, error = 0x%02x\n",
+				    ret);
 				return (ret);
 			}
 			ee->device_addr += size_read;
@@ -983,8 +985,8 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
 		/* Read three first bytes to get important info */
 		error = mlx5e_get_eeprom_info(priv, &eeprom);
 		if (error) {
-			if_printf(priv->ifp, "%s:%d: Failed reading eeprom's "
-			    "initial information\n", __func__, __LINE__);
+			mlx5_en_err(priv->ifp,
+			    "Failed reading eeprom's initial information\n");
 			error = 0;
 			goto done;
 		}
@@ -998,8 +1000,7 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
 		/* Read the whole eeprom information */
 		error = mlx5e_get_eeprom(priv, &eeprom);
 		if (error) {
-			if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n",
-			    __func__, __LINE__);
+			mlx5_en_err(priv->ifp, "Failed reading eeprom\n");
 			error = 0;
 			/*
 			 * Continue printing partial information in case of

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Wed Oct  2 09:48:01 2019	(r352975)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Wed Oct  2 09:49:44 2019	(r352976)
@@ -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_criteria	= mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
 	if (!match_value || !match_criteria) {
-		if_printf(priv->ifp, "%s: alloc failed\n", __func__);
+		mlx5_en_err(priv->ifp, "alloc failed\n");
 		err = -ENOMEM;
 		goto add_eth_addr_rule_out;
 	}
@@ -467,7 +467,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx
 	max_list_size = 1 << MLX5_CAP_GEN(priv->mdev, log_max_vlan_list);
 
 	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",
 			    list_size, max_list_size);
 		list_size = max_list_size;
@@ -486,7 +486,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx
 
 	err = mlx5_modify_nic_vport_vlans(priv->mdev, vlans, list_size);
 	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);
 
 	kfree(vlans);
@@ -549,7 +549,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv,
 	if (IS_ERR(*rule_p)) {
 		err = PTR_ERR(*rule_p);
 		*rule_p = NULL;
-		if_printf(priv->ifp, "%s: add rule failed\n", __func__);
+		mlx5_en_err(priv->ifp, "add rule failed\n");
 	}
 
 	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_criteria	= mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
 	if (!match_value || !match_criteria) {
-		if_printf(priv->ifp, "%s: alloc failed\n", __func__);
+		mlx5_en_err(priv->ifp, "alloc failed\n");
 		err = -ENOMEM;
 		goto add_vlan_rule_out;
 	}
@@ -948,7 +948,7 @@ static void mlx5e_vport_context_update_addr_list(struc
 		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",
 			    is_uc ? "UC" : "MC", size, max_size);
 		size = max_size;
@@ -966,7 +966,7 @@ static void mlx5e_vport_context_update_addr_list(struc
 	err = mlx5_modify_nic_vport_mac_list(priv->mdev, list_type, addr_array, size);
 out:
 	if (err)
-		if_printf(priv->ifp,
+		mlx5_en_err(priv->ifp,
 			   "Failed to modify vport %s list err(%d)\n",
 			   is_uc ? "UC" : "MC", err);
 	kfree(addr_array);

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Wed Oct  2 09:48:01 2019	(r352975)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Wed Oct  2 09:49:44 2019	(r352976)
@@ -429,8 +429,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	if (error) {
 		priv->media_active_last = IFM_ETHER;
 		priv->ifp->if_baudrate = 1;
-		if_printf(priv->ifp, "%s: query port ptys failed: "
-		    "0x%x\n", __func__, error);
+		mlx5_en_err(priv->ifp, "query port ptys failed: 0x%x\n",
+		    error);
 		return;
 	}
 
@@ -448,8 +448,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	}
 
 	if (media_entry.subtype == 0) {
-		if_printf(priv->ifp, "%s: Could not find operational "
-		    "media subtype\n", __func__);
+		mlx5_en_err(priv->ifp,
+		    "Could not find operational media subtype\n");
 		return;
 	}
 
@@ -457,8 +457,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	case IFM_10G_ER:
 		error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type);
 		if (error != 0) {
-			if_printf(priv->ifp, "%s: query port pddr failed: %d\n",
-				  __func__, error);
+			mlx5_en_err(priv->ifp,
+			    "query port pddr failed: %d\n", error);
 		}
 		if (error != 0 || is_er_type == 0)
 			media_entry.subtype = IFM_10G_LR;
@@ -466,8 +466,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	case IFM_40G_LR4:
 		error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type);
 		if (error != 0) {
-			if_printf(priv->ifp, "%s: query port pddr failed: %d\n",
-				  __func__, error);
+			mlx5_en_err(priv->ifp,
+			    "query port pddr failed: %d\n", error);
 		}
 		if (error == 0 && is_er_type != 0)
 			media_entry.subtype = IFM_40G_ER4;
@@ -546,9 +546,8 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv)
 		error = -ENXIO;
 	} else if (priv->params.rx_pauseframe_control ||
 	    priv->params.tx_pauseframe_control) {
-		if_printf(priv->ifp,
-		    "Global pauseframes must be disabled before "
-		    "enabling PFC.\n");
+		mlx5_en_err(priv->ifp,
+		    "Global pauseframes must be disabled before enabling PFC.\n");
 		error = -EINVAL;
 	} else {
 		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),
 	    MLX5_PTYS_EN, 1);
 	if (error != 0) {
-		if_printf(dev, "Query port media capability failed\n");
+		mlx5_en_err(dev, "Query port media capability failed\n");
 		goto done;
 	}
 
@@ -596,14 +595,14 @@ mlx5e_media_change(struct ifnet *dev)
 	if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) {
 		link_mode = eth_proto_cap;
 		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;
 			goto done;
 		}
 	} else {
 		link_mode = link_mode & eth_proto_cap;
 		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;
 			goto done;
 		}
@@ -612,7 +611,7 @@ mlx5e_media_change(struct ifnet *dev)
 		/* check if PFC is enabled */
 		if (priv->params.rx_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;
 			goto done;
 		}
@@ -1021,7 +1020,8 @@ free_out:
 		    priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL,
 		    priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL);
 		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) ==
 	    0) {
 		if (priv->clbr_done != 0) {
-			if_printf(priv->ifp, "HW failed tstmp frozen %#jx %#jx,"
-			    "disabling\n",
+			mlx5_en_err(priv->ifp,
+			    "HW failed tstmp frozen %#jx %#jx, disabling\n",
 			     next->clbr_hw_curr, curr->clbr_hw_prev);
 			priv->clbr_done = 0;
 		}
@@ -1872,7 +1872,7 @@ mlx5e_drain_sq(struct mlx5e_sq *sq)
 	/* error out remaining requests */
 	error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
 	if (error != 0) {
-		if_printf(sq->ifp,
+		mlx5_en_err(sq->ifp,
 		    "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);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, err=%d\n",
-		    __func__, sw_mtu, err);
+		mlx5_en_err(ifp, "mlx5_set_port_mtu failed setting %d, err=%d\n",
+		    sw_mtu, err);
 		return (err);
 	}
 
 	/* Update vport context MTU */
 	err = mlx5_set_vport_mtu(mdev, hw_mtu);
 	if (err) {
-		if_printf(ifp, "%s: Failed updating vport context with MTU size, err=%d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "Failed updating vport context with MTU size, err=%d\n",
+		    err);
 	}
 
 	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);
 	}
 	if (err) {
-		if_printf(ifp, "Query port MTU, after setting new "
-		    "MTU value, failed\n");
+		mlx5_en_err(ifp,
+		    "Query port MTU, after setting new MTU value, failed\n");
 		return (err);
 	} else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) {
 		err = -E2BIG,
-		if_printf(ifp, "Port MTU %d is smaller than "
-                    "ifp mtu %d\n", hw_mtu, sw_mtu);
+		mlx5_en_err(ifp,
+		    "Port MTU %d is smaller than ifp mtu %d\n",
+		    hw_mtu, sw_mtu);
 	} else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) {
 		err = -EINVAL;
-                if_printf(ifp, "Port MTU %d is bigger than "
-                    "ifp mtu %d\n", hw_mtu, sw_mtu);
+                mlx5_en_err(ifp,
+		    "Port MTU %d is bigger than ifp mtu %d\n",
+		    hw_mtu, sw_mtu);
 	}
 	priv->params_ethtool.hw_mtu = hw_mtu;
 
@@ -2986,23 +2989,21 @@ mlx5e_open_locked(struct ifnet *ifp)
 
 #ifdef RSS
 	if (rss_getnumbuckets() > priv->params.num_channels) {
-		if_printf(ifp, "NOTE: There are more RSS buckets(%u) than "
-		    "channels(%u) available\n", rss_getnumbuckets(),
-		    priv->params.num_channels);
+		mlx5_en_info(ifp,
+		    "NOTE: There are more RSS buckets(%u) than channels(%u) available\n",
+		    rss_getnumbuckets(), priv->params.num_channels);
 	}
 #endif
 	err = mlx5e_open_tises(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_tises failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_open_tises failed, %d\n", err);
 		return (err);
 	}
 	err = mlx5_vport_alloc_q_counter(priv->mdev,
 	    MLX5_INTERFACE_PROTOCOL_ETH, &set_id);
 	if (err) {
-		if_printf(priv->ifp,
-		    "%s: mlx5_vport_alloc_q_counter failed: %d\n",
-		    __func__, err);
+		mlx5_en_err(priv->ifp,
+		    "mlx5_vport_alloc_q_counter failed: %d\n", err);
 		goto err_close_tises;
 	}
 	/* store counter set ID */
@@ -3010,32 +3011,30 @@ mlx5e_open_locked(struct ifnet *ifp)
 
 	err = mlx5e_open_channels(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_channels failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5e_open_channels failed, %d\n", err);
 		goto err_dalloc_q_counter;
 	}
 	err = mlx5e_open_rqt(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_rqt failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err);
 		goto err_close_channels;
 	}
 	err = mlx5e_open_tirs(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_tir failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err);
 		goto err_close_rqls;
 	}
 	err = mlx5e_open_flow_table(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_flow_table failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5e_open_flow_table failed, %d\n", err);
 		goto err_close_tirs;
 	}
 	err = mlx5e_add_all_vlan_rules(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_add_all_vlan_rules failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5e_add_all_vlan_rules failed, %d\n", err);
 		goto err_close_flow_table;
 	}
 	set_bit(MLX5E_STATE_OPENED, &priv->state);
@@ -3074,9 +3073,8 @@ mlx5e_open(void *arg)
 
 	PRIV_LOCK(priv);
 	if (mlx5_set_port_status(priv->mdev, MLX5_PORT_UP))
-		if_printf(priv->ifp,
-		    "%s: Setting port status to up failed\n",
-		    __func__);
+		mlx5_en_err(priv->ifp,
+		    "Setting port status to up failed\n");
 
 	mlx5e_open_locked(priv->ifp);
 	priv->ifp->if_drv_flags |= IFF_DRV_RUNNING;
@@ -3213,7 +3211,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 				mlx5e_open_locked(ifp);
 		} else {
 			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));
 		}
 		PRIV_UNLOCK(priv);
@@ -3267,7 +3266,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 			    !(IFCAP_TXCSUM & ifp->if_capenable)) {
 				ifp->if_capenable &= ~IFCAP_TSO4;
 				ifp->if_hwassist &= ~CSUM_IP_TSO;
-				if_printf(ifp,
+				mlx5_en_err(ifp,
 				    "tso4 disabled due to -txcsum.\n");
 			}
 		}
@@ -3279,7 +3278,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 			    !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
 				ifp->if_capenable &= ~IFCAP_TSO6;
 				ifp->if_hwassist &= ~CSUM_IP6_TSO;
-				if_printf(ifp,
+				mlx5_en_err(ifp,
 				    "tso6 disabled due to -txcsum6.\n");
 			}
 		}
@@ -3292,7 +3291,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 		if (mask & IFCAP_TSO4) {
 			if (!(IFCAP_TSO4 & 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;
 				goto out;
 			}
@@ -3302,7 +3301,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 		if (mask & IFCAP_TSO6) {
 			if (!(IFCAP_TSO6 & 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;
 				goto out;
 			}
@@ -3382,8 +3381,8 @@ out:
 		/* Get module_num which is required for the query_eeprom */
 		error = mlx5_query_module_num(priv->mdev, &module_num);
 		if (error) {
-			if_printf(ifp, "Query module num failed, eeprom "
-			    "reading is not supported\n");
+			mlx5_en_err(ifp,
+			    "Query module num failed, eeprom reading is not supported\n");
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3402,8 +3401,9 @@ out:
 		else if (i2c.dev_addr == 0xA2)
 			read_addr = MLX5E_I2C_ADDR_HIGH;
 		else {
-			if_printf(ifp, "Query eeprom failed, "
-			    "Invalid Address: %X\n", i2c.dev_addr);
+			mlx5_en_err(ifp,
+			    "Query eeprom failed, Invalid Address: %X\n",
+			    i2c.dev_addr);
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3412,8 +3412,8 @@ out:
 		    (uint32_t)i2c.offset, (uint32_t)i2c.len, module_num,
 		    (uint32_t *)i2c.data, &size_read);
 		if (error) {
-			if_printf(ifp, "Query eeprom failed, eeprom "
-			    "reading is not supported\n");
+			mlx5_en_err(ifp,
+			    "Query eeprom failed, eeprom reading is not supported\n");
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3426,8 +3426,8 @@ out:
 			    (uint32_t *)(i2c.data + size_read), &size_read);
 		}
 		if (error) {
-			if_printf(ifp, "Query eeprom failed, eeprom "
-			    "reading is not supported\n");
+			mlx5_en_err(ifp,
+			    "Query eeprom failed, eeprom reading is not supported\n");
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3563,7 +3563,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
 
 	in = mlx5_vzalloc(inlen);
 	if (in == NULL) {
-		if_printf(ifp, "%s: failed to allocate inbox\n", __func__);
+		mlx5_en_err(ifp, "failed to allocate inbox\n");
 		return (-ENOMEM);
 	}
 
@@ -3578,8 +3578,8 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
 
 	err = mlx5_core_create_mkey(mdev, mkey, in, inlen);
 	if (err)
-		if_printf(ifp, "%s: mlx5_core_create_mkey failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5_core_create_mkey failed, %d\n",
+		    err);
 
 	kvfree(in);
 	return (err);
@@ -3660,7 +3660,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq)
 	err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_ERR,
 	    MLX5_SQC_STATE_RST);
 	if (err != 0) {
-		if_printf(sq->ifp,
+		mlx5_en_err(sq->ifp,
 		    "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,
 	    MLX5_SQC_STATE_RDY);
 	if (err != 0) {
-		if_printf(sq->ifp,
+		mlx5_en_err(sq->ifp,
 		    "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);
 	if (err != 0) {
-		if_printf(rq->ifp,
+		mlx5_en_err(rq->ifp,
 		    "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);
 	if (err != 0) {
-		if_printf(rq->ifp,
+		mlx5_en_err(rq->ifp,
 		    "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);
 	err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RST, MLX5_RQC_STATE_RDY);
 	if (err != 0) {
-		if_printf(rq->ifp,
+		mlx5_en_err(rq->ifp,
 		    "mlx5e_modify_rq() from RST to RDY failed: %d\n", err);
         }
 
@@ -3943,7 +3943,7 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv)
 	/* update firmware */
 	error = mlx5e_set_port_pause_and_pfc(priv);
 	if (error == -EINVAL) {
-		if_printf(priv->ifp,
+		mlx5_en_err(priv->ifp,
 		    "Global pauseframes must be disabled before enabling PFC.\n");
 		priv->params.rx_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);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5_alloc_map_uar failed, %d\n", err);
 		goto err_free_wq;
 	}
 	err = mlx5_core_alloc_pd(mdev, &priv->pdn);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_core_alloc_pd failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5_core_alloc_pd failed, %d\n", err);
 		goto err_unmap_free_uar;
 	}
 	err = mlx5_alloc_transport_domain(mdev, &priv->tdn);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_alloc_transport_domain failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5_alloc_transport_domain failed, %d\n", err);
 		goto err_dealloc_pd;
 	}
 	err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_create_mkey failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err);
 		goto err_dealloc_transport_domain;
 	}
 	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 &&
 	    is_zero_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
 	err = mlx5e_rl_init(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_rl_init failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_rl_init failed, %d\n", err);
 		goto err_create_mkey;
 	}
 #endif
@@ -4315,8 +4311,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
 			    connector_type);
 	} else {
 		eth_proto_cap = 0;
-		if_printf(ifp, "%s: Query port media capability failed,"
-		    " %d\n", __func__, err);
+		mlx5_en_err(ifp, "Query port media capability failed, %d\n", err);
 	}
 
 	ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK,
@@ -4439,8 +4434,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp
 	 * detaching:
 	 */
 	while (READ_ONCE(priv->rl.stats.tx_active_connections) != 0) {
-		if_printf(priv->ifp, "Waiting for all ratelimit connections "
-		    "to terminate\n");
+		mlx5_en_err(priv->ifp,
+		    "Waiting for all ratelimit connections to terminate\n");
 		pause("W", hz);
 	}
 #endif
@@ -4461,8 +4456,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp
 
 	/* wait for all unlimited send tags to go away */
 	while (priv->channel_refs != 0) {
-		if_printf(priv->ifp, "Waiting for all unlimited connections "
-		    "to terminate\n");
+		mlx5_en_err(priv->ifp,
+		    "Waiting for all unlimited connections to terminate\n");
 		pause("W", hz);
 	}
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c	Wed Oct  2 09:48:01 2019	(r352975)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c	Wed Oct  2 09:49:44 2019	(r352976)
@@ -518,7 +518,7 @@ mlx5e_rl_worker(void *arg)
 
 		MLX5E_RL_WORKER_LOCK(rlw);
 		if (error != 0) {
-			if_printf(priv->ifp,
+			mlx5_en_err(priv->ifp,
 			    "mlx5e_rl_open_channel failed: %d\n", error);
 			break;
 		}
@@ -551,7 +551,7 @@ mlx5e_rl_worker(void *arg)
 					MLX5E_RL_RUNLOCK(&priv->rl);
 
 					if (error != 0) {
-						if_printf(priv->ifp,
+						mlx5_en_err(priv->ifp,
 						    "mlx5e_rl_open_channel failed: %d\n", error);
 					} else {
 						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,
 				    channel->new_rate * 8ULL);
 				if (error != 0) {
-					if_printf(priv->ifp,
+					mlx5_en_err(priv->ifp,
 					    "mlx5e_rlw_channel_set_rate_locked failed: %d\n",
 					    error);
 				}
@@ -574,7 +574,7 @@ mlx5e_rl_worker(void *arg)
 			case MLX5E_RL_ST_DESTROY:
 				error = mlx5e_rlw_channel_set_rate_locked(rlw, channel, 0);
 				if (error != 0) {
-					if_printf(priv->ifp,
+					mlx5_en_err(priv->ifp,
 					    "mlx5e_rlw_channel_set_rate_locked failed: %d\n",
 					    error);
 				}
@@ -855,7 +855,7 @@ mlx5e_rl_init(struct mlx5e_priv *priv)
 	PRIV_UNLOCK(priv);
 
 	if (error != 0) {
-		if_printf(priv->ifp,
+		mlx5_en_err(priv->ifp,
 		    "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,
 		    RFHIGHPID, 0, "mlx5-ratelimit", "mlx5-rl-worker-thread-%d", (int)j);
 		if (error != 0) {
-			if_printf(rl->priv->ifp,
+			mlx5_en_err(rl->priv->ifp,
 			    "kproc_kthread_add failed: %d\n", error);
 			rlw->worker_done = 1;
 		}
@@ -1089,7 +1089,8 @@ mlx5e_find_available_tx_ring_index(struct mlx5e_rl_wor
 
 	*pchannel = channel;
 #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
 	return (retval);
 }

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c	Wed Oct  2 09:48:01 2019	(r352975)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c	Wed Oct  2 09:49:44 2019	(r352976)
@@ -48,6 +48,6 @@ mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int eve
 {
 	struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq);
 
-	if_printf(cq->priv->ifp, "%s: cqn=0x%.6x event=0x%.2x\n",
-	    __func__, mcq->cqn, event);
+	mlx5_en_err(cq->priv->ifp, "cqn=0x%.6x event=0x%.2x\n",
+	    mcq->cqn, event);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910020949.x929njxv017186>